diff options
74 files changed, 1551 insertions, 29 deletions
diff --git a/2.3-1/demos/Abhinav_Demos/test_gsort.sci b/2.3-1/demos/Abhinav_Demos/test_gsort.sci new file mode 100644 index 00000000..bd51c697 --- /dev/null +++ b/2.3-1/demos/Abhinav_Demos/test_gsort.sci @@ -0,0 +1,81 @@ +// Test file for "Column" function for the data types double, float, double complex, string , uint16. +// All the below statements are added to initialize variables in different data types +//The function written doesn't work for string or character scalar as of now. + + +function test_gsort() + seq= [1 21 4; 10 5 98; 3.21 8.921 1000] + disp(seq) + disp('') + a= gsort(seq); + b= gsort(seq, 'r'); + c= gsort(seq, 'c'); + d= gsort(seq, 'r', 'i'); + e= gsort(seq, 'c', 'd'); + disp('Double') + disp(a) + disp('') + disp(b) + disp('') + disp(c) + disp('') + disp(d) + disp('') + disp(e) + disp('') + seq1= float(seq); + disp('') + f= gsort(seq1); + g= gsort(seq1, 'r'); + h= gsort(seq1, 'c'); + i= gsort(seq1, 'r', 'i'); + j= gsort(seq1, 'c', 'd'); + disp('Float') + disp(f) + disp('') + disp(g) + disp('') + disp(h) + disp('') + disp(i) + disp('') + disp(j) + disp('') + seq2= uint16(seq); + disp('') + k= gsort(seq2); + l= gsort(seq2, 'r'); + m= gsort(seq2, 'c'); + n= gsort(seq2, 'r', 'i'); + o= gsort(seq2, 'c', 'd'); + disp('Uint16') + disp(k) + disp('') + disp(l) + disp('') + disp(m) + disp('') + disp(n) + disp('') + disp(o) + disp('') + seq3= [%i*21, 65+%i*7, %i*121, 56; %i*6112, 12 ,3, 0] + disp('') + p= gsort(seq3); + q= gsort(seq3, 'r'); + r1= gsort(seq3, 'c'); + s= gsort(seq3, 'r', 'i'); + t= gsort(seq3, 'c', 'd'); + disp('Double Complex') + disp(p) + disp('') + disp(q) + disp('') + disp(r1) + disp('') + disp(s) + disp('') + disp(t) + disp('') + +endfunction diff --git a/2.3-1/demos/Abhinav_Demos/test_pertrans.sci b/2.3-1/demos/Abhinav_Demos/test_pertrans.sci new file mode 100644 index 00000000..a84f7257 --- /dev/null +++ b/2.3-1/demos/Abhinav_Demos/test_pertrans.sci @@ -0,0 +1,31 @@ +// Test file for "Column" function for the data types double, float, double complex, string , uint16. +// All the below statements are added to initialize variables in different data types +//The function written doesn't work for string or character scalar as of now. + + +function test_pertrans() + a= [1 2 3; 4 5 6; 7 8 9] + b= pertrans(a) + disp('Double') + disp(b) + disp('') + disp(pertrans(6)) + disp('') + c= float(a) + d=pertrans(c) + e= float(2) + disp('Float') + disp(d) + disp('') + disp(pertrans(e)) + disp('') + f=[%i*121+12; 4+%i*7;1] + g= pertrans(f) + disp('Double Complex') + disp(g) + disp('') + disp(pertrans(%i*8712+12)) + disp('') + + +endfunction diff --git a/2.3-1/demos/Abhinav_Demos/test_rank.sci b/2.3-1/demos/Abhinav_Demos/test_rank.sci new file mode 100644 index 00000000..95f4a7dc --- /dev/null +++ b/2.3-1/demos/Abhinav_Demos/test_rank.sci @@ -0,0 +1,20 @@ +// Test file for "Column" function for the data types double, float, double complex, string , uint16. +// All the below statements are added to initialize variables in different data types +//The function written doesn't work for string or character scalar as of now. + + +function test_rank() + disp(" ** RANK ** ") + disp('Double') + A = [1,2,3,11;4,5,0.1,2.12;7,0,0,16.11] // Matrix - A + s = rank(A) // Calling Function Sequence + disp(s) + disp('') + + disp('Double Complex') + B= [%i*12, 12 , 12; 98*%i , 24*%i, 0; 12, %i*12, 0]; + t= rank(B) + disp(t) + disp('') + +endfunction diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index 06b8e4ab..0597e632 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -529,6 +529,9 @@ extern "C" { /*interfacing nnz*/ #include "int_nnz.h" #include "nnz.h" +/*interfacing pertrans*/ +#include "int_pertrans.h" +#include "pertrans.h" /*interfacing cumprod*/ #include "int_cumprod.h" #include "cumprod.h" @@ -672,6 +675,9 @@ extern "C" { /* interfacing median */ #include "median.h" #include "int_median.h" +/* interfacing gsort */ +#include "gsort.h" +#include "int_gsort.h" /* interfacing moment */ #include "moment.h" #include "int_moment.h" @@ -804,6 +810,9 @@ extern "C" { #include "svd.h" /*Linear Alegbra - Singular value decompostion */ #include "int_svd.h" +#include "rank.h" /*Linear Alegbra - Rank Using Singular value decompostion */ +#include "int_rank.h" + #include "rcond.h" #include "int_rcond.h" diff --git a/2.3-1/jar/scilab_en_US_help.jar b/2.3-1/jar/scilab_en_US_help.jar Binary files differindex 63e33626..7abb6800 100644 --- a/2.3-1/jar/scilab_en_US_help.jar +++ b/2.3-1/jar/scilab_en_US_help.jar diff --git a/2.3-1/macros/ASTManagement/lib b/2.3-1/macros/ASTManagement/lib Binary files differdeleted file mode 100644 index dee4362f..00000000 --- a/2.3-1/macros/ASTManagement/lib +++ /dev/null diff --git a/2.3-1/macros/CCodeGeneration/lib b/2.3-1/macros/CCodeGeneration/lib Binary files differdeleted file mode 100644 index 3d4fed1d..00000000 --- a/2.3-1/macros/CCodeGeneration/lib +++ /dev/null diff --git a/2.3-1/macros/ErrorMessages/lib b/2.3-1/macros/ErrorMessages/lib Binary files differdeleted file mode 100644 index ba3b9a5a..00000000 --- a/2.3-1/macros/ErrorMessages/lib +++ /dev/null diff --git a/2.3-1/macros/FunctionAnnotation/lib b/2.3-1/macros/FunctionAnnotation/lib Binary files differdeleted file mode 100644 index 239105c8..00000000 --- a/2.3-1/macros/FunctionAnnotation/lib +++ /dev/null diff --git a/2.3-1/macros/FunctionList/lib b/2.3-1/macros/FunctionList/lib Binary files differdeleted file mode 100644 index 1c722dd0..00000000 --- a/2.3-1/macros/FunctionList/lib +++ /dev/null diff --git a/2.3-1/macros/GeneralFunctions/lib b/2.3-1/macros/GeneralFunctions/lib Binary files differdeleted file mode 100644 index 7586a91b..00000000 --- a/2.3-1/macros/GeneralFunctions/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/AVR/lib b/2.3-1/macros/Hardware/AVR/lib Binary files differdeleted file mode 100644 index ed4c52b8..00000000 --- a/2.3-1/macros/Hardware/AVR/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/lib b/2.3-1/macros/Hardware/RasberryPi/Digital/lib Binary files differdeleted file mode 100644 index ba42ba7c..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/Digital/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/lib b/2.3-1/macros/Hardware/RasberryPi/I2C/lib Binary files differdeleted file mode 100644 index 561476c1..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/I2C/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/Interrupt/lib b/2.3-1/macros/Hardware/RasberryPi/Interrupt/lib Binary files differdeleted file mode 100644 index 97a61acb..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/Interrupt/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/lib b/2.3-1/macros/Hardware/RasberryPi/Misc/lib Binary files differdeleted file mode 100644 index c718615f..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/Misc/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/lib b/2.3-1/macros/Hardware/RasberryPi/SPI/lib Binary files differdeleted file mode 100644 index a16d474e..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/SPI/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/lib b/2.3-1/macros/Hardware/RasberryPi/Serial/lib Binary files differdeleted file mode 100644 index a007f001..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/Serial/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/lib b/2.3-1/macros/Hardware/RasberryPi/Setup/lib Binary files differdeleted file mode 100644 index 83655c94..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/Setup/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/lib b/2.3-1/macros/Hardware/RasberryPi/Shift/lib Binary files differdeleted file mode 100644 index 2b12025f..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/Shift/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/lib b/2.3-1/macros/Hardware/RasberryPi/Soft/lib Binary files differdeleted file mode 100644 index 09ecede9..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/Soft/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/lib b/2.3-1/macros/Hardware/RasberryPi/Timing/lib Binary files differdeleted file mode 100644 index d271c900..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/Timing/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/lib b/2.3-1/macros/Hardware/RasberryPi/gertBoard/lib Binary files differdeleted file mode 100644 index e8db080c..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/gertBoard/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/lib b/2.3-1/macros/Hardware/RasberryPi/lcd/lib Binary files differdeleted file mode 100644 index c2b693fa..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/lcd/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/lib b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/lib Binary files differdeleted file mode 100644 index 94dfda86..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/lib b/2.3-1/macros/Hardware/RasberryPi/lib Binary files differdeleted file mode 100644 index 49ed8116..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/lib b/2.3-1/macros/Hardware/RasberryPi/mcp/lib Binary files differdeleted file mode 100644 index d411aad8..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/mcp/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/lib b/2.3-1/macros/Hardware/RasberryPi/pcf/lib Binary files differdeleted file mode 100644 index da6a8dad..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/pcf/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/lib b/2.3-1/macros/Hardware/RasberryPi/piGlow/lib Binary files differdeleted file mode 100644 index 3f30f859..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/piGlow/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/lib b/2.3-1/macros/Hardware/RasberryPi/pinMap/lib Binary files differdeleted file mode 100644 index 133363e6..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/pinMap/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/lib b/2.3-1/macros/Hardware/RasberryPi/pwm/lib Binary files differdeleted file mode 100644 index 8711baf0..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/pwm/lib +++ /dev/null diff --git a/2.3-1/macros/ImageProcessing/core/lib b/2.3-1/macros/ImageProcessing/core/lib Binary files differdeleted file mode 100644 index 40b7b0a1..00000000 --- a/2.3-1/macros/ImageProcessing/core/lib +++ /dev/null diff --git a/2.3-1/macros/ImageProcessing/highgui/lib b/2.3-1/macros/ImageProcessing/highgui/lib Binary files differdeleted file mode 100644 index 0d7f88a9..00000000 --- a/2.3-1/macros/ImageProcessing/highgui/lib +++ /dev/null diff --git a/2.3-1/macros/ImageProcessing/imgproc/lib b/2.3-1/macros/ImageProcessing/imgproc/lib Binary files differdeleted file mode 100644 index 63b5e7e9..00000000 --- a/2.3-1/macros/ImageProcessing/imgproc/lib +++ /dev/null diff --git a/2.3-1/macros/Scilab-Arduino/lib b/2.3-1/macros/Scilab-Arduino/lib Binary files differdeleted file mode 100644 index a62fd4e4..00000000 --- a/2.3-1/macros/Scilab-Arduino/lib +++ /dev/null diff --git a/2.3-1/macros/SymbolTable/lib b/2.3-1/macros/SymbolTable/lib Binary files differdeleted file mode 100644 index 4379c83d..00000000 --- a/2.3-1/macros/SymbolTable/lib +++ /dev/null diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 3e634030..59ad9568 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -2557,6 +2557,57 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+// --------------------
+// --- Class Gsort. ---
+// --------------------
+ClassName = 'Gsort';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2g2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+PrintStringInfo('s2g2'+ArgSeparator+'s2',ClassFileName,'file','y');
+PrintStringInfo('s2g2g2'+ArgSeparator+'s2',ClassFileName,'file','y');
+PrintStringInfo('u162'+ArgSeparator+'u162',ClassFileName,'file','y');
+PrintStringInfo('u162g2'+ArgSeparator+'u162',ClassFileName,'file','y');
+PrintStringInfo('u162g2g2'+ArgSeparator+'u162',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('z2g2'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('z2g2g2'+ArgSeparator+'z2',ClassFileName,'file','y');
+
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'gsort'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
// ------------------------
// --- Class OpDotStar. ---
// ------------------------
@@ -7979,6 +8030,39 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class PERTRANS---------------------
+//------------------------------------
+ClassName = 'PERTRANS';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(2)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(1)',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y');
+
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'pertrans';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
//------------------------------------
//---- Class TRIU ---------------------
//------------------------------------
@@ -9553,6 +9637,34 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,Ex //------------------------------------
+//---- Class RANK ---------------------
+//------------------------------------
+ClassName = 'RANK';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'z0',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'rank';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+//------------------------------------
//---- Class SVA ---------------------
//------------------------------------
ClassName = 'SVA';
diff --git a/2.3-1/macros/ToolInitialization/lib b/2.3-1/macros/ToolInitialization/lib Binary files differdeleted file mode 100644 index 670a52e0..00000000 --- a/2.3-1/macros/ToolInitialization/lib +++ /dev/null diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index aba0ec08..6ffc9aad 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -67,6 +67,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/matrixOperations/includes/cumsum.h" "src/c/matrixOperations/includes/matrix.h" "src/c/matrixOperations/includes/nnz.h" + "src/c/matrixOperations/includes/pertrans.h" "src/c/matrixOperations/includes/cumprod.h" "src/c/matrixOperations/includes/triu.h" "src/c/matrixOperations/includes/tril.h" @@ -157,6 +158,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/statisticsFunctions/includes/mean.h" "src/c/statisticsFunctions/includes/median.h" "src/c/statisticsFunctions/includes/nanmedian.h" + "src/c/statisticsFunctions/includes/gsort.h" "src/c/statisticsFunctions/includes/nanstdev.h" "src/c/statisticsFunctions/includes/mad.h" "src/c/statisticsFunctions/includes/meanf.h" @@ -266,6 +268,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/linearAlgebra/includes/balanc.h" "src/c/linearAlgebra/includes/svd.h" "src/c/linearAlgebra/includes/lu.h" + "src/c/linearAlgebra/includes/rank.h" "src/c/linearAlgebra/includes/hess.h" "src/c/linearAlgebra/includes/sva.h" "src/c/linearAlgebra/includes/sqroot.h" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index f57f33b1..633365c2 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -55,6 +55,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/matrixOperations/interfaces/int_cumsum.h" "src/c/matrixOperations/interfaces/int_matrix.h" "src/c/matrixOperations/interfaces/int_nnz.h" + "src/c/matrixOperations/interfaces/int_pertrans.h" "src/c/matrixOperations/interfaces/int_cumprod.h" "src/c/matrixOperations/interfaces/int_triu.h" "src/c/matrixOperations/interfaces/int_tril.h" @@ -146,6 +147,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/statisticsFunctions/interfaces/int_mean.h" "src/c/statisticsFunctions/interfaces/int_median.h" "src/c/statisticsFunctions/interfaces/int_nanmedian.h" + "src/c/statisticsFunctions/interfaces/int_gsort.h" "src/c/statisticsFunctions/interfaces/int_nanstdev.h" "src/c/statisticsFunctions/interfaces/int_mad.h" "src/c/statisticsFunctions/interfaces/int_meanf.h" @@ -262,6 +264,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/linearAlgebra/interfaces/int_balanc.h" "src/c/linearAlgebra/interfaces/int_svd.h" "src/c/linearAlgebra/interfaces/int_lu.h" + "src/c/linearAlgebra/interfaces/int_rank.h" "src/c/linearAlgebra/interfaces/int_sqroot.h" "src/c/linearAlgebra/interfaces/int_hess.h" "src/c/linearAlgebra/interfaces/int_sva.h" diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index effb893a..64f57fbd 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -314,6 +314,13 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/matrixOperations/nnz/snnzs.c" "src/c/matrixOperations/nnz/znnza.c" "src/c/matrixOperations/nnz/znnzs.c" + "src/c/matrixOperations/pertrans/dpertransa.c" + "src/c/matrixOperations/pertrans/dpertranss.c" + "src/c/matrixOperations/pertrans/spertransa.c" + "src/c/matrixOperations/pertrans/spertranss.c" + "src/c/matrixOperations/pertrans/zpertransa.c" + "src/c/matrixOperations/pertrans/zpertranss.c" + //"src/c/matrixOperations/nnz/znnzs.c" "src/c/matrixOperations/triu/dtriua.c" "src/c/matrixOperations/triu/striua.c" "src/c/matrixOperations/triu/u8triua.c" @@ -1034,6 +1041,18 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/statisticsFunctions/nanmedian/znanmediana.c" "src/c/statisticsFunctions/nanmedian/znanmediancola.c" "src/c/statisticsFunctions/nanmedian/znanmedianrowa.c" + "src/c/statisticsFunctions/gsort/dgsorta.c" + "src/c/statisticsFunctions/gsort/dgsortrowa.c" + "src/c/statisticsFunctions/gsort/dgsortcola.c" + "src/c/statisticsFunctions/gsort/sgsorta.c" + "src/c/statisticsFunctions/gsort/sgsortrowa.c" + "src/c/statisticsFunctions/gsort/sgsortcola.c" + "src/c/statisticsFunctions/gsort/u16gsorta.c" + "src/c/statisticsFunctions/gsort/u16gsortcola.c" + "src/c/statisticsFunctions/gsort/u16gsortrowa.c" + "src/c/statisticsFunctions/gsort/zgsorta.c" + "src/c/statisticsFunctions/gsort/zgsortcola.c" + "src/c/statisticsFunctions/gsort/zgsortrowa.c" "src/c/statisticsFunctions/nanstdev/dnanstdeva.c" "src/c/statisticsFunctions/nanstdev/dnanstdevrowa.c" "src/c/statisticsFunctions/nanstdev/dnanstdevcola.c" @@ -1552,6 +1571,8 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/linearAlgebra/svd/dsvda.c" "src/c/linearAlgebra/lu/dlua.c" "src/c/linearAlgebra/svd/zsvda.c" + "src/c/linearAlgebra/rank/dranka.c" + "src/c/linearAlgebra/rank/zranka.c" "src/c/linearAlgebra/sqroot/dsqroota.c" "src/c/linearAlgebra/hess/dhessa.c" "src/c/linearAlgebra/givens/dgivensa.c" diff --git a/2.3-1/macros/findDeps/lib b/2.3-1/macros/findDeps/lib Binary files differdeleted file mode 100644 index afcd3cab..00000000 --- a/2.3-1/macros/findDeps/lib +++ /dev/null diff --git a/2.3-1/macros/lib b/2.3-1/macros/lib Binary files differdeleted file mode 100644 index 551263ea..00000000 --- a/2.3-1/macros/lib +++ /dev/null diff --git a/2.3-1/src/c/linearAlgebra/includes/rank.h b/2.3-1/src/c/linearAlgebra/includes/rank.h new file mode 100644 index 00000000..0a21b4f8 --- /dev/null +++ b/2.3-1/src/c/linearAlgebra/includes/rank.h @@ -0,0 +1,29 @@ + /* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RANK_H__ +#define __RANK_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dranka(double* in1, int rows, int cols); + +doubleComplex zranka(doubleComplex* in1, int rows, int cols); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RANK_H__*/ diff --git a/2.3-1/src/c/linearAlgebra/interfaces/int_rank.h b/2.3-1/src/c/linearAlgebra/interfaces/int_rank.h new file mode 100644 index 00000000..5c04e717 --- /dev/null +++ b/2.3-1/src/c/linearAlgebra/interfaces/int_rank.h @@ -0,0 +1,28 @@ + /* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_RANK_H__ +#define __INT_RANK_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2rankd0(in1,size1) dranka(in1, size1[0], size1[1]) + +#define z2rankz0(in1,size1) zranka(in1, size1[0], size1[1]) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RANK_H__*/ diff --git a/2.3-1/src/c/linearAlgebra/rank/dranka.c b/2.3-1/src/c/linearAlgebra/rank/dranka.c new file mode 100644 index 00000000..ebfb5a80 --- /dev/null +++ b/2.3-1/src/c/linearAlgebra/rank/dranka.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Funtion to find inverse condition number of square matrix*/ + +#include "lapack.h" +#include "stdlib.h" +#include "string.h" +#include "rank.h" +#include "svd.h" + +double dranka(double* in1, int rows, int cols) +{ + double out1[rows*rows]; + double out2[rows*cols]; + double out3[cols*cols]; + double rk; + + + rk = dsvda(0,in1,rows,cols, 0, 4, out1, out2, out3); + + + return rk; + +} diff --git a/2.3-1/src/c/linearAlgebra/rank/zranka.c b/2.3-1/src/c/linearAlgebra/rank/zranka.c new file mode 100644 index 00000000..0efad251 --- /dev/null +++ b/2.3-1/src/c/linearAlgebra/rank/zranka.c @@ -0,0 +1,82 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Funtion to find inverse condition number of square matrix*/ + +#include "lapack.h" +#include "stdlib.h" +#include "stdio.h" +#include "string.h" +#include "rank.h" +#include "svd.h" +#include "doubleComplex.h" +#include "addition.h" + +#define eps 2.22044604925e-16 + +doubleComplex zranka(doubleComplex* in1, int rows, int cols) +{ + doubleComplex out1[rows*rows]; + doubleComplex out2[rows*cols]; + doubleComplex out3[cols*cols]; + doubleComplex rk=0; + + + zsvda(in1,rows,cols, 0, 3, out1, out2, out3); + +double tol = (double)max(rows,cols)*eps*zreals(out2[0]) ; + +/* +for(int i=0; i< rows*rows; i++) + printf("%lf + i*%lf \t", zreals(out1[i]), zimags(out1[i])); +printf("\n"); + +for(int i=0; i< rows*cols; i++) + printf("%lf + i*%lf \t", zreals(out2[i]), zimags(out2[i])); +printf("\n"); + +for(int i=0; i< cols*cols; i++) + printf("%lf + i*%lf \t", zreals(out3[i]), zimags(out3[i])); +printf("\n"); + +*/ + +if(rows<cols) +{ + for(int i=0;i< rows;i++) + { + if( zreals(out2[i+i*rows]) > tol) + { + rk = zadds(rk,1); + } + } + +} + +else +{ + + for(int i=0;i< cols;i++) + { + if( zreals(out2[i+i*rows]) > tol) + { + rk = zadds(rk,1); + } + } + + + +} + + return rk; + +} diff --git a/2.3-1/src/c/matrixOperations/includes/pertrans.h b/2.3-1/src/c/matrixOperations/includes/pertrans.h new file mode 100644 index 00000000..2c385ace --- /dev/null +++ b/2.3-1/src/c/matrixOperations/includes/pertrans.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __PERTRANS_H__ +#define __PERTRANS_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dpertransa(double *in, int row, int col, double* out); +double dpertranss(double in); + +void spertransa(float *in, int row, int col, float* out); +float spertranss(float in); + +void zpertransa(doubleComplex *in, int row, int col, doubleComplex* out); +doubleComplex zpertranss(doubleComplex in); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__PERTRANS_H__*/ diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_pertrans.h b/2.3-1/src/c/matrixOperations/interfaces/int_pertrans.h new file mode 100644 index 00000000..8aa8ec5e --- /dev/null +++ b/2.3-1/src/c/matrixOperations/interfaces/int_pertrans.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_PERTRANS_H__ +#define __INT_PERTRANS_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2pertransd2(in1, size, out) dpertransa(in1, size[0], size[1], out) +#define d0pertransd0(in1) dpertranss(in1) + +#define s2pertranss2(in1, size, out) spertransa(in1, size[0], size[1], out) +#define s0pertranss0(in1) spertranss(in1) + +#define z2pertransz2(in1, size, out) zpertransa(in1, size[0], size[1], out) +#define z0pertransz0(in1) zpertranss(in1) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_PERTRANS_H__*/ diff --git a/2.3-1/src/c/matrixOperations/pertrans/dpertransa.c b/2.3-1/src/c/matrixOperations/pertrans/dpertransa.c new file mode 100644 index 00000000..36b963ec --- /dev/null +++ b/2.3-1/src/c/matrixOperations/pertrans/dpertransa.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" + +void dpertransa(double *in, int row, int col, double* out) +{ + + double middle[row*col]; + int j=0; + + dtransposea(in, row, col, middle); + + for(int i= row*col-1; i>=0; i=i-1) + { + + out[j]= middle[i]; + j=j+1; + + } + + + + +} diff --git a/2.3-1/src/c/matrixOperations/pertrans/dpertranss.c b/2.3-1/src/c/matrixOperations/pertrans/dpertranss.c new file mode 100644 index 00000000..10c2d036 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/pertrans/dpertranss.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" + +double dpertranss(double in) +{ + + return in; + + +} diff --git a/2.3-1/src/c/matrixOperations/pertrans/spertransa.c b/2.3-1/src/c/matrixOperations/pertrans/spertransa.c new file mode 100644 index 00000000..4eba2f16 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/pertrans/spertransa.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" + +void spertransa(float *in, int row, int col, float* out) +{ + + float middle[row*col]; + int j=0; + + stransposea(in, row, col, middle); + + for(int i= row*col-1; i>=0; i=i-1) + { + + out[j]= middle[i]; + j=j+1; + + } + + + + +} diff --git a/2.3-1/src/c/matrixOperations/pertrans/spertranss.c b/2.3-1/src/c/matrixOperations/pertrans/spertranss.c new file mode 100644 index 00000000..694c2317 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/pertrans/spertranss.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" + +float spertranss(float in) +{ + + return in; + + +} diff --git a/2.3-1/src/c/matrixOperations/pertrans/zpertransa.c b/2.3-1/src/c/matrixOperations/pertrans/zpertransa.c new file mode 100644 index 00000000..c52fdbc0 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/pertrans/zpertransa.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" +#include "doubleComplex.h" + +void zpertransa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + + doubleComplex middle[row*col]; + int j=0; + + ztransposea(in, row, col, middle); + + for(int i= row*col-1; i>=0; i=i-1) + { + + out[j]= middle[i]; + j=j+1; + + } + + + + +} diff --git a/2.3-1/src/c/matrixOperations/pertrans/zpertranss.c b/2.3-1/src/c/matrixOperations/pertrans/zpertranss.c new file mode 100644 index 00000000..73e6e618 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/pertrans/zpertranss.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" +#include "doubleComplex.h" + +doubleComplex zpertranss(doubleComplex in) +{ + + return in; + + +} diff --git a/2.3-1/src/c/signalProcessing/hank/dhanka.c b/2.3-1/src/c/signalProcessing/hank/dhanka.c index 1857cc20..37008fd6 100644 --- a/2.3-1/src/c/signalProcessing/hank/dhanka.c +++ b/2.3-1/src/c/signalProcessing/hank/dhanka.c @@ -20,6 +20,8 @@ void dhanka(int m, int n, double*seq_conv, int row, int col, double*out) { + +// Variable Declaration Start int mr, nr; mr= m* row; nr= n* row; @@ -31,8 +33,9 @@ void dhanka(int m, int n, double*seq_conv, int row, int col, double*out) double middle2[m*nr]; double index[m*nr]; double final[row*m*nr]; +// Variable Declaration End - +// Algorithm Start donesa(ones1, 1 , nr); donesa(ones2, m , 1); int j=0; @@ -106,5 +109,6 @@ printf("\n"); */ dmatrixa(final, row, m*nr, mr, (row*m*nr)/mr, out); +//Algorith Ends } diff --git a/2.3-1/src/c/statisticsFunctions/gsort/dgsorta.c b/2.3-1/src/c/statisticsFunctions/gsort/dgsorta.c new file mode 100644 index 00000000..8585b54e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/dgsorta.c @@ -0,0 +1,94 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void dgsorta(double *in, int size, char check, double* out) +{ + double a; double fin; double in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + +if(check == 'i') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } +} + +if(check =='d') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] < in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + +} + + for(int i=0; i< size; i++) + + { + out[i]= in_copy[i]; + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/dgsortcola.c b/2.3-1/src/c/statisticsFunctions/gsort/dgsortcola.c new file mode 100644 index 00000000..56cb3e8b --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/dgsortcola.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void dgsortcola(double *in, int row, int col, char check, double* out) +{ + double inter[col]; + double temp[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + + dgsorta( inter, col, check, temp); + + for(int k=0; k< col; k++) + { + out[i + k*row]= temp[k]; + + } + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/dgsortrowa.c b/2.3-1/src/c/statisticsFunctions/gsort/dgsortrowa.c new file mode 100644 index 00000000..cb2b819d --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/dgsortrowa.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void dgsortrowa(double *in, int row, int col, char check, double* out) +{ + double inter[row]; + double temp[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + dgsorta( inter, row, check, temp); + + for(int k=0; k< row; k++) + { + out[k + i*row]= temp[k]; + + } + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/sgsorta.c b/2.3-1/src/c/statisticsFunctions/gsort/sgsorta.c new file mode 100644 index 00000000..35bbc93e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/sgsorta.c @@ -0,0 +1,94 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void sgsorta(float *in, int size, char check, float* out) +{ + float a; float fin; float in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + +if(check == 'i') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } +} + +if(check =='d') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] < in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + +} + + for(int i=0; i< size; i++) + + { + out[i]= in_copy[i]; + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/sgsortcola.c b/2.3-1/src/c/statisticsFunctions/gsort/sgsortcola.c new file mode 100644 index 00000000..7296f7f0 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/sgsortcola.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void sgsortcola(float *in, int row, int col, char check, float* out) +{ + float inter[col]; + float temp[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + sgsorta( inter, col, check, temp); + + for(int k=0; k< col; k++) + { + out[i + k*row]= temp[k]; + + } + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/sgsortrowa.c b/2.3-1/src/c/statisticsFunctions/gsort/sgsortrowa.c new file mode 100644 index 00000000..220b45a5 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/sgsortrowa.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void sgsortrowa(float *in, int row, int col, char check, float* out) +{ + float inter[row]; + float temp[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + sgsorta( inter, row, check, temp); + + for(int k=0; k< row; k++) + { + out[k + i*row]= temp[k]; + + } + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/u16gsorta.c b/2.3-1/src/c/statisticsFunctions/gsort/u16gsorta.c new file mode 100644 index 00000000..bca7b025 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/u16gsorta.c @@ -0,0 +1,94 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void u16gsorta(uint16 *in, int size, char check, uint16* out) +{ + uint16 a; uint16 fin; uint16 in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + +if(check == 'i') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } +} + +if(check =='d') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] < in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + +} + + for(int i=0; i< size; i++) + + { + out[i]= in_copy[i]; + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/u16gsortcola.c b/2.3-1/src/c/statisticsFunctions/gsort/u16gsortcola.c new file mode 100644 index 00000000..51ac7b5e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/u16gsortcola.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void u16gsortcola(uint16* in, int row, int col, char check, uint16* out) +{ + uint16 inter[col]; + uint16 temp[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + u16gsorta( inter, col, check, temp); + + for(int k=0; k< col; k++) + { + out[i + k*row]= temp[k]; + + } + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/u16gsortrowa.c b/2.3-1/src/c/statisticsFunctions/gsort/u16gsortrowa.c new file mode 100644 index 00000000..c8cbf4e9 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/u16gsortrowa.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void u16gsortrowa(uint16 *in, int row, int col, char check, uint16* out) +{ + uint16 inter[row]; + uint16 temp[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + u16gsorta( inter, row, check, temp); + + for(int k=0; k< row; k++) + { + out[k + i*row]= temp[k]; + + } + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/zgsorta.c b/2.3-1/src/c/statisticsFunctions/gsort/zgsorta.c new file mode 100644 index 00000000..0620a8cb --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/zgsorta.c @@ -0,0 +1,96 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "abs.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void zgsorta(doubleComplex *in, int size, char check, doubleComplex* out) +{ + doubleComplex a; doubleComplex fin; doubleComplex in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + +if(check == 'i') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (zabss(in_copy[i]) > zabss(in_copy[j])) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } +} + +if(check =='d') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (zabss(in_copy[i]) < zabss(in_copy[j])) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + +} + + for(int i=0; i< size; i++) + + { + out[i]= in_copy[i]; + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/zgsortcola.c b/2.3-1/src/c/statisticsFunctions/gsort/zgsortcola.c new file mode 100644 index 00000000..2c03623d --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/zgsortcola.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" +#include "doubleComplex.h" + +void zgsortcola(doubleComplex *in, int row, int col, char check, doubleComplex* out) +{ + doubleComplex inter[col]; + doubleComplex temp[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + zgsorta( inter, col, check, temp); + + for(int k=0; k< col; k++) + { + out[i + k*row]= temp[k]; + + } + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/gsort/zgsortrowa.c b/2.3-1/src/c/statisticsFunctions/gsort/zgsortrowa.c new file mode 100644 index 00000000..f02b0b24 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/gsort/zgsortrowa.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "doubleComplex.h" + +void zgsortrowa(doubleComplex *in, int row, int col, char check, doubleComplex* out) +{ + doubleComplex inter[row]; + doubleComplex temp[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + zgsorta( inter, row, check, temp); + + for(int k=0; k< row; k++) + { + out[k + i*row]= temp[k]; + + } + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/includes/gsort.h b/2.3-1/src/c/statisticsFunctions/includes/gsort.h new file mode 100644 index 00000000..a4d0870e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/includes/gsort.h @@ -0,0 +1,46 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __GSORT_H__ +#define __GSORT_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dgsorta(double *in, int size, char check, double* out); +void dgsortcola(double *in, int row, int col, char check, double* out); +void dgsortrowa(double *in, int row, int col, char check, double* out); + +void sgsorta(float *in, int size, char check, float* out); +void sgsortcola(float *in, int row, int col, char check, float* out); +void sgsortrowa(float *in, int row, int col, char check, float* out); + +void u16gsorta(uint16 *in, int size, char check, uint16* out); +void u16gsortcola(uint16 *in, int row, int col, char check, uint16* out); +void u16gsortrowa(uint16 *in, int row, int col, char check, uint16* out); + +void zgsorta(doubleComplex *in, int size, char check, doubleComplex* out); +void zgsortcola(doubleComplex *in, int row, int col, char check, doubleComplex* out); +void zgsortrowa(doubleComplex*in, int row, int col, char check, doubleComplex* out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__GSORT_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/interfaces/int_gsort.h b/2.3-1/src/c/statisticsFunctions/interfaces/int_gsort.h new file mode 100644 index 00000000..d1e9bb97 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/interfaces/int_gsort.h @@ -0,0 +1,43 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_GSORT_H__ +#define __INT_GSORT_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2gsortd2(in1, size, out) dgsorta(in1, size[0]* size[1], 'd', out) +#define d2g2gsortd2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dgsortrowa(in1, size1[0], size1[1],'d', out) :dgsortcola(in1, size1[0], size1[1],'d', out) +#define d2g2g2gsortd2(in1, size1, in2, size2, in3, size3, out) (in2[0]== 'r') ? dgsortrowa(in1, size1[0], size1[1],in3[0], out) :dgsortcola(in1, size1[0], size1[1],in3[0], out) + +#define s2gsorts2(in1, size, out) sgsorta(in1, size[0]* size[1], 'd', out) +#define s2g2gsorts2(in1, size1, in2, size2, out) (in2[0]== 'r') ? sgsortrowa(in1, size1[0], size1[1],'d', out) :sgsortcola(in1, size1[0], size1[1],'d', out) +#define s2g2g2gsorts2(in1, size1, in2, size2, in3, size3, out) (in2[0]== 'r') ? sgsortrowa(in1, size1[0], size1[1],in3[0], out) :sgsortcola(in1, size1[0], size1[1],in3[0], out) + +#define u162gsortu162(in1, size, out) u16gsorta(in1, size[0]* size[1], 'd', out) +#define u162g2gsortu162(in1, size1, in2, size2, out) (in2[0]== 'r') ? u16gsortrowa(in1, size1[0], size1[1],'d', out) :u16gsortcola(in1, size1[0], size1[1],'d', out) +#define u162g2g2gsortu162(in1, size1, in2, size2, in3, size3, out) (in2[0]== 'r') ? u16gsortrowa(in1, size1[0], size1[1],in3[0], out) :u16gsortcola(in1, size1[0], size1[1],in3[0], out) + +#define z2gsortz2(in1, size, out) zgsorta(in1, size[0]* size[1], 'd', out) +#define z2g2gsortz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? zgsortrowa(in1, size1[0], size1[1],'d', out) :zgsortcola(in1, size1[0], size1[1],'d', out) +#define z2g2g2gsortz2(in1, size1, in2, size2, in3, size3, out) (in2[0]== 'r') ? zgsortrowa(in1, size1[0], size1[1],in3[0], out) :zgsortcola(in1, size1[0], size1[1],in3[0], out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_GSORT_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/median/dmediana.c b/2.3-1/src/c/statisticsFunctions/median/dmediana.c index cb2463c5..8b37fd16 100644 --- a/2.3-1/src/c/statisticsFunctions/median/dmediana.c +++ b/2.3-1/src/c/statisticsFunctions/median/dmediana.c @@ -17,7 +17,9 @@ double dmediana(double *in, int size) { - double a; double fin; + double a; double fin; double in_copy[size]; +for(int i=0; i< size; i++) + in_copy[i]= in[i]; for (int i = 0; i < size; ++i) @@ -28,15 +30,15 @@ double dmediana(double *in, int size) { - if (in[i] > in[j]) + if (in_copy[i] > in_copy[j]) { - a = in[i]; + a = in_copy[i]; - in[i] = in[j]; + in_copy[i] = in_copy[j]; - in[j] = a; + in_copy[j] = a; } @@ -47,11 +49,11 @@ double dmediana(double *in, int size) if(size%2 ==0) { - fin= (in[size/2]+ in[(size/2)-1])/2; + fin= (in_copy[size/2]+ in_copy[(size/2)-1])/2; } else { - fin= in[(size-1)/2]; + fin= in_copy[(size-1)/2]; } return fin; diff --git a/2.3-1/src/c/statisticsFunctions/median/smediana.c b/2.3-1/src/c/statisticsFunctions/median/smediana.c index 9e86b77e..0d427e10 100644 --- a/2.3-1/src/c/statisticsFunctions/median/smediana.c +++ b/2.3-1/src/c/statisticsFunctions/median/smediana.c @@ -17,8 +17,10 @@ float smediana(float *in, int size) { - float a; float fin; + float a; float fin; float in_copy[size]; +for(int i=0; i< size; i++) + in_copy[i]= in[i]; for (int i = 0; i < size; ++i) @@ -28,15 +30,15 @@ float smediana(float *in, int size) { - if (in[i] > in[j]) + if (in_copy[i] > in_copy[j]) { - a = in[i]; + a = in_copy[i]; - in[i] = in[j]; + in_copy[i] = in_copy[j]; - in[j] = a; + in_copy[j] = a; } @@ -46,11 +48,11 @@ float smediana(float *in, int size) if(size%2 ==0) { - fin= (in[size/2]+ in[(size/2)-1])/2; + fin= (in_copy[size/2]+ in_copy[(size/2)-1])/2; } else { - fin= in[(size-1)/2]; + fin= in_copy[(size-1)/2]; } return fin; diff --git a/2.3-1/src/c/statisticsFunctions/median/u16mediana.c b/2.3-1/src/c/statisticsFunctions/median/u16mediana.c index b45c5302..85cfedce 100644 --- a/2.3-1/src/c/statisticsFunctions/median/u16mediana.c +++ b/2.3-1/src/c/statisticsFunctions/median/u16mediana.c @@ -17,8 +17,10 @@ uint16 u16mediana(uint16 *in, int size) { - uint16 a; uint16 fin; + uint16 a; uint16 fin; uint16 in_copy[size]; +for(int i=0; i< size; i++) + in_copy[i]= in[i]; for (int i = 0; i < size; ++i) @@ -28,15 +30,15 @@ uint16 u16mediana(uint16 *in, int size) { - if (in[i] > in[j]) + if (in_copy[i] > in_copy[j]) { - a = in[i]; + a = in_copy[i]; - in[i] = in[j]; + in_copy[i] = in_copy[j]; - in[j] = a; + in_copy[j] = a; } @@ -46,11 +48,11 @@ uint16 u16mediana(uint16 *in, int size) if(size%2 ==0) { - fin= (in[size/2]+ in[(size/2)-1])/2; + fin= (in_copy[size/2]+ in_copy[(size/2)-1])/2; } else { - fin= in[(size-1)/2]; + fin= in_copy[(size-1)/2]; } return fin; diff --git a/2.3-1/src/c/statisticsFunctions/median/zmediana.c b/2.3-1/src/c/statisticsFunctions/median/zmediana.c index 32726e77..36804562 100644 --- a/2.3-1/src/c/statisticsFunctions/median/zmediana.c +++ b/2.3-1/src/c/statisticsFunctions/median/zmediana.c @@ -21,8 +21,10 @@ doubleComplex zmediana(doubleComplex *in, int size) { - doubleComplex a; doubleComplex fin; doubleComplex middle; + doubleComplex a; doubleComplex fin; doubleComplex middle; doubleComplex in_copy[size]; +for(int i=0; i< size; i++) + in_copy[i]= in[i]; for (int i = 0; i < size; ++i) @@ -32,15 +34,15 @@ doubleComplex zmediana(doubleComplex *in, int size) { - if (zabss(in[i]) > zabss(in[j])) + if (zabss(in_copy[i]) > zabss(in_copy[j])) { - a = in[i]; + a = in_copy[i]; - in[i] = in[j]; + in_copy[i] = in_copy[j]; - in[j] = a; + in_copy[j] = a; } @@ -52,12 +54,12 @@ doubleComplex zmediana(doubleComplex *in, int size) if(size%2 ==0) { - middle= zadds(in[size/2], in[(size/2)-1]); + middle= zadds(in_copy[size/2], in_copy[(size/2)-1]); fin= zrdivs(middle, DoubleComplex(2,0)); } else { - fin= in[(size-1)/2]; + fin= in_copy[(size-1)/2]; } return fin; |