diff options
author | harpreet | 2016-07-01 00:11:55 +0530 |
---|---|---|
committer | harpreet | 2016-07-01 00:11:55 +0530 |
commit | 89b96cb79cbe75ba8c1afea61b3caca37a083f62 (patch) | |
tree | 1b879fb0dce2406c1c49bf5bdabcedfb12ff020c /sci_gateway/cpp/sci_sym_remove.cpp | |
parent | 10e2e4d8b4a7592a8631ddac8e8d1664d6f0b9e3 (diff) | |
download | FOSSEE-Optimization-toolbox-89b96cb79cbe75ba8c1afea61b3caca37a083f62.tar.gz FOSSEE-Optimization-toolbox-89b96cb79cbe75ba8c1afea61b3caca37a083f62.tar.bz2 FOSSEE-Optimization-toolbox-89b96cb79cbe75ba8c1afea61b3caca37a083f62.zip |
Windows Included
Diffstat (limited to 'sci_gateway/cpp/sci_sym_remove.cpp')
-rw-r--r-- | sci_gateway/cpp/sci_sym_remove.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sci_gateway/cpp/sci_sym_remove.cpp b/sci_gateway/cpp/sci_sym_remove.cpp index 0289064..c09cbc7 100644 --- a/sci_gateway/cpp/sci_sym_remove.cpp +++ b/sci_gateway/cpp/sci_sym_remove.cpp @@ -17,6 +17,8 @@ extern "C" { #include <api_scilab.h> #include <Scierror.h> #include <BOOL.h> +#include <stdlib.h> +#include <malloc.h> #include <localization.h> #include <sciprint.h> //function to remove specified columns @@ -30,7 +32,7 @@ int sci_sym_delete_cols(char *fname, unsigned long fname_len){ int num_cols;//stores the number of columns in the loaded problem int iType= 0;//stores the datatype of matrix int rows=0,columns=0;//integer variables to denote the number of rows and columns in the array denoting the column numbers to be deleted - unsigned int *value=NULL;//pointer to integer array allocated dynamically having the indices to be deleted + int *value=NULL;//pointer to integer array allocated dynamically having the indices to be deleted double *array_ptr=NULL;//double array pointer to the array denoting the column numbers to be deleted int *piAddressVarOne = NULL;//pointer used to access first and second arguments of the function int output=0;//output parameter for the symphony sym_delete_cols function @@ -63,11 +65,11 @@ int sci_sym_delete_cols(char *fname, unsigned long fname_len){ } //dynamically allocate the integer array - value=(unsigned int *)malloc(sizeof(unsigned int)*columns); + value=(int *)malloc(sizeof(int)*columns); //store double values in the integer array by typecasting while(count<columns) { - value[count]=(unsigned int)array_ptr[count]; + value[count]=(int)array_ptr[count]; count++; } sciprint("\n"); @@ -103,7 +105,7 @@ int sci_sym_delete_cols(char *fname, unsigned long fname_len){ } //only when the number of columns to be deleted is lesser than the actual number of columns ,execution is proceeded with if(columns<=num_cols){ - output=sym_delete_cols(global_sym_env,(unsigned int)columns,value);//symphony function to delete the columns specified + output=sym_delete_cols(global_sym_env,(int)columns,value);//symphony function to delete the columns specified if(output==FUNCTION_TERMINATED_NORMALLY) { sciprint("Execution is successfull\n"); @@ -147,7 +149,7 @@ int sci_sym_delete_rows(char *fname, unsigned long fname_len){ int num_rows;//stores the number of columns in the loaded problem int iType= 0;//stores the datatype of matrix int rows=0,columns=0;//integer variables to denote the number of rows and columns in the array denoting the row numbers to be deleted - unsigned int *value=NULL;//pointer to integer array allocated dynamically having the indices to be deleted + int *value=NULL;//pointer to integer array allocated dynamically having the indices to be deleted double *array_ptr=NULL;//double array pointer to the array denoting the rows numbers to be deleted int *piAddressVarTwo = NULL;//pointer used to access first and second arguments of the function int output=0;//output parameter for the symphony sym_delete_rows function @@ -179,11 +181,11 @@ int sci_sym_delete_rows(char *fname, unsigned long fname_len){ } //dynamically allocate the integer array - value=(unsigned int *)malloc(sizeof(unsigned int)*columns); + value=(int *)malloc(sizeof(int)*columns); //store double values in the integer array by typecasting while(count<columns) { - value[count]=(unsigned int)array_ptr[count]; + value[count]=(int)array_ptr[count]; count++; } sciprint("\n"); @@ -219,7 +221,7 @@ int sci_sym_delete_rows(char *fname, unsigned long fname_len){ } //only when the number of rows to be deleted is lesser than the actual number of rows ,execution is proceeded with if(columns<=num_rows){ - output=sym_delete_rows(global_sym_env,(unsigned int)columns,value);//symphony function to delete the rows specified + output=sym_delete_rows(global_sym_env,(int)columns,value);//symphony function to delete the rows specified if(output==FUNCTION_TERMINATED_NORMALLY) { sciprint("Execution is successfull\n"); @@ -252,8 +254,4 @@ int sci_sym_delete_rows(char *fname, unsigned long fname_len){ return 0; } - - - - } |