diff options
author | Brijeshcr | 2017-07-18 11:50:51 +0530 |
---|---|---|
committer | GitHub | 2017-07-18 11:50:51 +0530 |
commit | 753a1302afb561e618d554b7d8b2c21e50562c43 (patch) | |
tree | ca35baab9f80f50bfdce12ffd00257e3b297df95 /2.3-1 | |
parent | 966afe93dbda0568dc376534ac94704ebbfb0329 (diff) | |
parent | ecbb528a2b7823d0512f3869f4d220e568c10025 (diff) | |
download | Scilab2C-753a1302afb561e618d554b7d8b2c21e50562c43.tar.gz Scilab2C-753a1302afb561e618d554b7d8b2c21e50562c43.tar.bz2 Scilab2C-753a1302afb561e618d554b7d8b2c21e50562c43.zip |
Merge pull request #19 from abhinavdronamraju/master
Updated the functions added. Changes are able to merge.
Diffstat (limited to '2.3-1')
42 files changed, 1244 insertions, 14 deletions
diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index dbfc8ccf..a98181c4 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -182,6 +182,9 @@ extern "C" { /*interfacing isscalar*/ #include "isscalar.h" #include "int_isscalar.h" +/*interfacing isvector*/ +#include "isvector.h" +#include "int_isvector.h" /*interfacing iscolumn*/ #include "iscolumn.h" #include "int_iscolumn.h" @@ -465,6 +468,9 @@ extern "C" { /*interfacing matrix*/ #include "int_matrix.h" #include "matrix.h" +/*interfacing nnz*/ +#include "int_nnz.h" +#include "nnz.h" /*interfacing cumprod*/ #include "int_cumprod.h" #include "cumprod.h" @@ -595,6 +601,9 @@ extern "C" { /* interfacing mean */ #include "mean.h" #include "int_mean.h" +/* interfacing median */ +#include "median.h" +#include "int_median.h" /* interfacing stdevf */ #include "stdevf.h" #include "int_stdevf.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 90c41f4b..ccb99610 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/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 85472a8a..89ffc36f 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -1047,6 +1047,39 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+// -------------------
+// --- Class Isvector. ---
+// -------------------
+ClassName = 'Isvector';
+
+// --- 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');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''g''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+//---Function list class. ----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g2'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('z0'+ArgSeparator+'g0',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'isvector';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
// -------------------
// --- Class Iscolumn. ---
// -------------------
@@ -1911,6 +1944,11 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'median'; // 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);
+
FunctionName = 'st_deviation'; // BJ : Not implemented
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
@@ -7213,30 +7251,50 @@ PrintStringInfo('OUT(1).SZ(2)= IN(3).VAL',ClassFileName,'file','y'); ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
PrintStringInfo('d2d0d0'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('d2s0s0'+ArgSeparator+'d2',ClassFileName,'file','y');
-PrintStringInfo('d2u160u160'+ArgSeparator+'d2',ClassFileName,'file','y');
-PrintStringInfo('d2u80u80'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('z2d0d0'+ArgSeparator+'z2',ClassFileName,'file','y');
PrintStringInfo('z2s0s0'+ArgSeparator+'z2',ClassFileName,'file','y');
-
PrintStringInfo('s2d0d0'+ArgSeparator+'s2',ClassFileName,'file','y');
PrintStringInfo('s2s0s0'+ArgSeparator+'s2',ClassFileName,'file','y');
-PrintStringInfo('s2u160u160'+ArgSeparator+'s2',ClassFileName,'file','y');
-PrintStringInfo('s2u80u80'+ArgSeparator+'s2',ClassFileName,'file','y');
-PrintStringInfo('u162'+ArgSeparator+'u162',ClassFileName,'file','y');
-PrintStringInfo('i162'+ArgSeparator+'i162',ClassFileName,'file','y');
-
PrintStringInfo('u162d0d0'+ArgSeparator+'u162',ClassFileName,'file','y');
PrintStringInfo('u162s0s0'+ArgSeparator+'u162',ClassFileName,'file','y');
-PrintStringInfo('u82g2'+ArgSeparator+'u82',ClassFileName,'file','y');
-PrintStringInfo('i82g2'+ArgSeparator+'i82',ClassFileName,'file','y');
-PrintStringInfo('u162g2'+ArgSeparator+'u162',ClassFileName,'file','y');
-PrintStringInfo('i162g2'+ArgSeparator+'i162',ClassFileName,'file','y');
+
// --- Annotation Function And Function List Function. ---
FunctionName = 'matrix';
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//------------------------------------
+//---- Class NNZ---------------------
+//------------------------------------
+ClassName = 'NNZ';
+
+// --- 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= ''u16''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('d0'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('z0'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'u160',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'nnz';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
//------------------------------------
//---- Class TRIU ---------------------
diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index cf606ab5..95ec1e9f 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -66,6 +66,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/matrixOperations/includes/diag.h" "src/c/matrixOperations/includes/cumsum.h" "src/c/matrixOperations/includes/matrix.h" + "src/c/matrixOperations/includes/nnz.h" "src/c/matrixOperations/includes/cumprod.h" "src/c/matrixOperations/includes/triu.h" "src/c/matrixOperations/includes/tril.h" @@ -133,6 +134,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/elementaryFunctions/includes/nthroot.h" "src/c/elementaryFunctions/includes/issquare.h" "src/c/elementaryFunctions/includes/isscalar.h" + "src/c/elementaryFunctions/includes/isvector.h" "src/c/elementaryFunctions/includes/iscolumn.h" "src/c/elementaryFunctions/includes/ismatrix.h" "src/c/elementaryFunctions/includes/asind.h" @@ -141,6 +143,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/statisticsFunctions/includes/variance.h" "src/c/statisticsFunctions/includes/sum.h" "src/c/statisticsFunctions/includes/mean.h" + "src/c/statisticsFunctions/includes/median.h" "src/c/statisticsFunctions/includes/meanf.h" "src/c/statisticsFunctions/includes/stdevf.h" "src/c/statisticsFunctions/includes/prod.h" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index 977ea76e..80043733 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -54,6 +54,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/matrixOperations/interfaces/int_diag.h" "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_cumprod.h" "src/c/matrixOperations/interfaces/int_triu.h" "src/c/matrixOperations/interfaces/int_tril.h" @@ -104,6 +105,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/elementaryFunctions/interfaces/int_nthroot.h" "src/c/elementaryFunctions/interfaces/int_issquare.h" "src/c/elementaryFunctions/interfaces/int_isscalar.h" + "src/c/elementaryFunctions/interfaces/int_isvector.h" "src/c/elementaryFunctions/interfaces/int_iscolumn.h" "src/c/elementaryFunctions/interfaces/int_ismatrix.h" "src/c/elementaryFunctions/interfaces/int_logspace.h" @@ -130,6 +132,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/elementaryFunctions/interfaces/int_lcm.h" "src/c/elementaryFunctions/interfaces/int_isequal.h" "src/c/statisticsFunctions/interfaces/int_mean.h" + "src/c/statisticsFunctions/interfaces/int_median.h" "src/c/statisticsFunctions/interfaces/int_meanf.h" "src/c/statisticsFunctions/interfaces/int_stdevf.h" "src/c/statisticsFunctions/interfaces/int_prod.h" diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index 60908c88..13371619 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -308,6 +308,12 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/matrixOperations/matrix/smatrixa.c" "src/c/matrixOperations/matrix/u16matrixa.c" "src/c/matrixOperations/matrix/zmatrixa.c" + "src/c/matrixOperations/nnz/dnnza.c" + "src/c/matrixOperations/nnz/dnnzs.c" + "src/c/matrixOperations/nnz/snnza.c" + "src/c/matrixOperations/nnz/snnzs.c" + "src/c/matrixOperations/nnz/znnza.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" @@ -798,7 +804,6 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/elementaryFunctions/nthroot/snthroota.c" "src/c/elementaryFunctions/nthroot/snthroot1a.c" "src/c/elementaryFunctions/nthroot/snthroots.c" - "src/c/elementaryFunctions/isscalar/disscalara.c" "src/c/elementaryFunctions/isscalar/disscalars.c" "src/c/elementaryFunctions/isscalar/gisscalars.c" @@ -817,6 +822,14 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/elementaryFunctions/iscolumn/ziscolumns.c" "src/c/elementaryFunctions/iscolumn/u16iscolumna.c" "src/c/elementaryFunctions/iscolumn/u16iscolumns.c" + "src/c/elementaryFunctions/isvector/disvectora.c" + "src/c/elementaryFunctions/isvector/disvectors.c" + "src/c/elementaryFunctions/isvector/gisvectors.c" + "src/c/elementaryFunctions/isvector/gisvectora.c" + "src/c/elementaryFunctions/isvector/sisvectors.c" + "src/c/elementaryFunctions/isvector/sisvectora.c" + "src/c/elementaryFunctions/isvector/zisvectora.c" + "src/c/elementaryFunctions/isvector/zisvectors.c" "src/c/elementaryFunctions/ismatrix/dismatrixa.c" "src/c/elementaryFunctions/ismatrix/dismatrixs.c" //"src/c/elementaryFunctions/ismatrix/gismatrixs.c" @@ -915,6 +928,18 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/statisticsFunctions/meanf/zmeanfdz.c" "src/c/statisticsFunctions/meanf/cmeanfsc.c" "src/c/statisticsFunctions/meanf/zcolumnmeanfa.c" +"src/c/statisticsFunctions/median/dmediana.c" +"src/c/statisticsFunctions/median/dmedianrowa.c" +"src/c/statisticsFunctions/median/dmediancola.c" +"src/c/statisticsFunctions/median/smediana.c" +"src/c/statisticsFunctions/median/smedianrowa.c" +"src/c/statisticsFunctions/median/smediancola.c" +"src/c/statisticsFunctions/median/u16mediana.c" +"src/c/statisticsFunctions/median/u16medianrowa.c" +"src/c/statisticsFunctions/median/u16mediancola.c" +"src/c/statisticsFunctions/median/zmediana.c" +"src/c/statisticsFunctions/median/zmediancola.c" +"src/c/statisticsFunctions/median/zmedianrowa.c" "src/c/statisticsFunctions/prod/srowproda.c" "src/c/statisticsFunctions/prod/drowproda.c" "src/c/statisticsFunctions/prod/dproda.c" diff --git a/2.3-1/src/c/auxiliaryFunctions/abs/zabss.c b/2.3-1/src/c/auxiliaryFunctions/abs/zabss.c index 4e7b4dd3..7ada57d1 100644 --- a/2.3-1/src/c/auxiliaryFunctions/abs/zabss.c +++ b/2.3-1/src/c/auxiliaryFunctions/abs/zabss.c @@ -16,6 +16,7 @@ #include "sqrt.h" #include "max.h" #include "min.h" +#include "doubleComplex.h" double zabss(doubleComplex in) { double real = dabss(zreals(in)); diff --git a/2.3-1/src/c/elementaryFunctions/includes/isvector.h b/2.3-1/src/c/elementaryFunctions/includes/isvector.h new file mode 100644 index 00000000..5f45abbe --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/isvector.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 __ISVECTOR_H__ +#define __ISVECTOR_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char disvectora(double* , int); +char disvectors(double); +char sisvectora( float* , int); +char sisvectors( float); +char gisvectora(char* , int); +char gisvectors(char); +char zisvectora(doubleComplex*, int); +char zisvectors(doubleComplex); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h new file mode 100644 index 00000000..6d943bd3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h @@ -0,0 +1,26 @@ + /*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_ISVECTOR_H__ +#define __INT_ISVECTOR_H__ + +#define d2isvectorg0(in, size ) disvectora(in, size[0]) +#define d0isvectorg0(in) disvectors(in) +#define s2isvectorg0(in , size) sisvectora(in, size[0]) +#define s0isvectorg0(in) sisvectors(in) +#define g2isvectorg0(in, size) gisvectora(in, size[0]) +#define g0isvectorg0(in) gisvectors(in) +#define z2isvectorg0(in, size) zisvectora(in , size[0]) +#define z0isvectorg0(in) zisvectors(in) + + +#endif diff --git a/2.3-1/src/c/elementaryFunctions/isvector/disvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/disvectora.c new file mode 100644 index 00000000..3c41027f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/disvectora.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 <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +char disvectora(double* inp, int size1) +{ + if(size1 ==1) + return 'T'; + return 'F'; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/disvectors.c b/2.3-1/src/c/elementaryFunctions/isvector/disvectors.c new file mode 100644 index 00000000..703e6673 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/disvectors.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 <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char disvectors(double inp) +{ + double out='F'; + + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.c new file mode 100644 index 00000000..d2e261e9 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.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 <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +#include "string.h" +char gisvectora(char *inp, int size1) +{ + if(size1 ==1) + return 'T'; + return 'F'; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/gisvectors.c b/2.3-1/src/c/elementaryFunctions/isvector/gisvectors.c new file mode 100644 index 00000000..72118603 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/gisvectors.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 <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char gisvectors(char inp) +{ + char out='F'; + + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.c new file mode 100644 index 00000000..09ad6515 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.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 <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +char sisvectora(float* inp, int size1) +{ + if(size1 ==1) + return 'T'; + return 'F'; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/sisvectors.c b/2.3-1/src/c/elementaryFunctions/isvector/sisvectors.c new file mode 100644 index 00000000..019bd464 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/sisvectors.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 <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char sisvectors(float inp) +{ + char out='F'; + + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c new file mode 100644 index 00000000..fba78124 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c @@ -0,0 +1,25 @@ +/* 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 <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "doubleComplex.h" +#include "isvector.h" +#include "types.h" + +char zisvectora(doubleComplex *inp, int size1) +{ + if(size1 ==1) + return 'T'; + return 'F'; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/zisvectors.c b/2.3-1/src/c/elementaryFunctions/isvector/zisvectors.c new file mode 100644 index 00000000..bc9e5ce6 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/zisvectors.c @@ -0,0 +1,25 @@ +/* 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 <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +#include "doubleComplex.h" + +char zisvectors(doubleComplex inp) +{ + char out='F'; + + return out; +} diff --git a/2.3-1/src/c/matrixOperations/includes/matrix.h b/2.3-1/src/c/matrixOperations/includes/matrix.h index dbb0e223..582fd221 100644 --- a/2.3-1/src/c/matrixOperations/includes/matrix.h +++ b/2.3-1/src/c/matrixOperations/includes/matrix.h @@ -16,6 +16,8 @@ #include "types.h" #include "doubleComplex.h" +#include "uint16.h" + #ifdef __cplusplus extern "C" { diff --git a/2.3-1/src/c/matrixOperations/includes/nnz.h b/2.3-1/src/c/matrixOperations/includes/nnz.h new file mode 100644 index 00000000..c7d2d491 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/includes/nnz.h @@ -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 +*/ + + +#ifndef __NNZ_H__ +#define __NNZ_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 dnnza(double* , int , int); +uint16 dnnzs(double); +uint16 snnza( float* , int , int); +uint16 snnzs( float); +uint16 znnza(doubleComplex *, int , int); +uint16 znnzs(doubleComplex); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NNZ_H__*/ diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_matrix.h b/2.3-1/src/c/matrixOperations/interfaces/int_matrix.h index f69ba116..5935f4a3 100644 --- a/2.3-1/src/c/matrixOperations/interfaces/int_matrix.h +++ b/2.3-1/src/c/matrixOperations/interfaces/int_matrix.h @@ -46,4 +46,4 @@ extern "C" { } /* extern "C" */ #endif -#endif /*__INT_CUMSUM_H__*/ +#endif /*__INT_MATRIX_H__*/ diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_nnz.h b/2.3-1/src/c/matrixOperations/interfaces/int_nnz.h new file mode 100644 index 00000000..0ef39536 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/interfaces/int_nnz.h @@ -0,0 +1,35 @@ +/* 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_NNZ_H__ +#define __INT_NNZ_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2nnzu160(in1, size) dnnza(in1, size[0], size[1]) +#define d0nnzu160(in) dnnzs(in) + +#define s2nnzu160(in1, size) snnza(in1, size[0], size[1]) +#define s0nnzu160(in) snnzs(in) + +#define z2nnzu160(in1, size) znnza(in1, size[0], size[1]) +#define z0nnzu160(in) znnzs(in) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NNZ_H__*/ diff --git a/2.3-1/src/c/matrixOperations/nnz/dnnza.c b/2.3-1/src/c/matrixOperations/nnz/dnnza.c new file mode 100644 index 00000000..b4d40bd8 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/dnnza.c @@ -0,0 +1,33 @@ +/* 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 +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 dnnza(double *in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if( in[i] != 0) + { + final++; + + } + + } +return final; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/dnnzs.c b/2.3-1/src/c/matrixOperations/nnz/dnnzs.c new file mode 100644 index 00000000..c878d331 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/dnnzs.c @@ -0,0 +1,25 @@ +/* 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 +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 dnnzs(double in) +{ + if(in !=0) + return 1; + else + return 0; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/snnza.c b/2.3-1/src/c/matrixOperations/nnz/snnza.c new file mode 100644 index 00000000..df27f0fe --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/snnza.c @@ -0,0 +1,33 @@ +/* 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 +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 snnza(float*in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if( in[i] != 0) + { + final++; + + } + + } +return final; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/snnzs.c b/2.3-1/src/c/matrixOperations/nnz/snnzs.c new file mode 100644 index 00000000..674d4fac --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/snnzs.c @@ -0,0 +1,25 @@ +/* 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 +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 snnzs(float in) +{ + if(in !=0) + return 1; + else + return 0; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/znnza.c b/2.3-1/src/c/matrixOperations/nnz/znnza.c new file mode 100644 index 00000000..3b913e8b --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/znnza.c @@ -0,0 +1,33 @@ +/* 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 +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +uint16 znnza(doubleComplex* in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if(( zreals(in[i]) !=0 )||( zimags(in[i])!=0)) + { + final++; + + } + + } +return final; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/znnzs.c b/2.3-1/src/c/matrixOperations/nnz/znnzs.c new file mode 100644 index 00000000..2907afcf --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/znnzs.c @@ -0,0 +1,26 @@ +/* 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 +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +uint16 znnzs(doubleComplex in) +{ + if((zreals(in)== 0 ) && (zimags(in)==0)) + return 0; + else + return 1; +} diff --git a/2.3-1/src/c/operations/addition/zadds.c b/2.3-1/src/c/operations/addition/zadds.c index d4a94dc5..768faf38 100644 --- a/2.3-1/src/c/operations/addition/zadds.c +++ b/2.3-1/src/c/operations/addition/zadds.c @@ -11,6 +11,7 @@ */ #include "addition.h" +#include "doubleComplex.h" doubleComplex zadds(doubleComplex z1, doubleComplex z2) { return DoubleComplex(zreals(z1) + zreals(z2), diff --git a/2.3-1/src/c/statisticsFunctions/includes/median.h b/2.3-1/src/c/statisticsFunctions/includes/median.h new file mode 100644 index 00000000..accb5df0 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/includes/median.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 __MEDIAN_H__ +#define __MEDIAN_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmediana(double* , int ); +void dmedianrowa(double*, int, int, double*); +void dmediancola(double*, int, int, double*); + +float smediana(float* , int ); +void smedianrowa(float*, int, int, float*); +void smediancola(float*, int, int, float*); + +uint16 u16mediana(uint16* , int ); +void u16medianrowa(uint16*, int, int, uint16*); +void u16mediancola(uint16*, int, int, uint16*); + +doubleComplex zmediana(doubleComplex* , int ); +void zmedianrowa(doubleComplex*, int, int, doubleComplex*); +void zmediancola(doubleComplex*, int, int, doubleComplex*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MATRIX_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/interfaces/int_median.h b/2.3-1/src/c/statisticsFunctions/interfaces/int_median.h new file mode 100644 index 00000000..2a219870 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/interfaces/int_median.h @@ -0,0 +1,57 @@ +/* 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_MEDIAN_H__ +#define __INT_MEDIAN_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2mediand0(in1, size) dmediana(in1, size[0]* size[1]) +#define d2g2mediand2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dmedianrowa(in1, size1[0], size1[1], out) :dmediancola(in1, size1[0], size1[1], out) + +#define s2medians0(in1, size) smediana(in1, size[0]* size[1]) +#define s2g2medians2(in1, size1, in2, size2, out) (in2[0]== 'r') ? smedianrowa(in1, size1[0], size1[1], out) :smediancola(in1, size1[0], size1[1], out) + +#define u162medianu160(in1, size) u16mediana(in1, size[0]* size[1]) +#define u162g2medianu162(in1, size1, in2, size2, out) (in2[0]== 'r') ? u16medianrowa(in1, size1[0], size1[1], out) :u16mediancola(in1, size1[0], size1[1], out) + +#define z2medianz0(in1, size) zmediana(in1, size[0]* size[1]) +#define z2g2medianz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? zmedianrowa(in1, size1[0], size1[1], out) :zmediancola(in1, size1[0], size1[1], out) + + +#define s2d0d0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +#define s2s0s0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + +#define u162d0d0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out) +#define u162s0s0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + +#define z2d0d0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out) +#define z2s0s0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MATRIX_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/median/dmediana.c b/2.3-1/src/c/statisticsFunctions/median/dmediana.c new file mode 100644 index 00000000..cb2463c5 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/dmediana.c @@ -0,0 +1,58 @@ +/* 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 "median.h" +#include "types.h" +#include "uint16.h" + +double dmediana(double *in, int size) +{ + double a; double fin; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in[i] > in[j]) + + { + + a = in[i]; + + in[i] = in[j]; + + in[j] = a; + + } + + } + + } + + + if(size%2 ==0) + { + fin= (in[size/2]+ in[(size/2)-1])/2; + } + else + { + fin= in[(size-1)/2]; + } + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/median/dmediancola.c b/2.3-1/src/c/statisticsFunctions/median/dmediancola.c new file mode 100644 index 00000000..b3ff4fb8 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/dmediancola.c @@ -0,0 +1,35 @@ +/* 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 "median.h" +#include "types.h" +#include "uint16.h" + +void dmediancola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dmediana( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/dmedianrowa.c b/2.3-1/src/c/statisticsFunctions/median/dmedianrowa.c new file mode 100644 index 00000000..4b5879c5 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/dmedianrowa.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 "median.h" +#include "types.h" +#include "uint16.h" + +void dmedianrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dmediana( inter, row); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/smediana.c b/2.3-1/src/c/statisticsFunctions/median/smediana.c new file mode 100644 index 00000000..9e86b77e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/smediana.c @@ -0,0 +1,57 @@ +/* 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 "median.h" +#include "types.h" +#include "uint16.h" + +float smediana(float *in, int size) +{ + float a; float fin; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in[i] > in[j]) + + { + + a = in[i]; + + in[i] = in[j]; + + in[j] = a; + + } + + } + + } + + if(size%2 ==0) + { + fin= (in[size/2]+ in[(size/2)-1])/2; + } + else + { + fin= in[(size-1)/2]; + } + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/median/smediancola.c b/2.3-1/src/c/statisticsFunctions/median/smediancola.c new file mode 100644 index 00000000..2fc4eaf1 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/smediancola.c @@ -0,0 +1,35 @@ +/* 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 "median.h" +#include "types.h" +#include "uint16.h" + +void smediancola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= smediana( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/smedianrowa.c b/2.3-1/src/c/statisticsFunctions/median/smedianrowa.c new file mode 100644 index 00000000..aab59382 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/smedianrowa.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 "median.h" +#include "types.h" +#include "uint16.h" + +void smedianrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= smediana( inter, row); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/u16mediana.c b/2.3-1/src/c/statisticsFunctions/median/u16mediana.c new file mode 100644 index 00000000..b45c5302 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/u16mediana.c @@ -0,0 +1,57 @@ +/* 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 "median.h" +#include "types.h" +#include "uint16.h" + +uint16 u16mediana(uint16 *in, int size) +{ + uint16 a; uint16 fin; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in[i] > in[j]) + + { + + a = in[i]; + + in[i] = in[j]; + + in[j] = a; + + } + + } + + } + + if(size%2 ==0) + { + fin= (in[size/2]+ in[(size/2)-1])/2; + } + else + { + fin= in[(size-1)/2]; + } + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/median/u16mediancola.c b/2.3-1/src/c/statisticsFunctions/median/u16mediancola.c new file mode 100644 index 00000000..77952a35 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/u16mediancola.c @@ -0,0 +1,35 @@ +/* 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 "median.h" +#include "types.h" +#include "uint16.h" + +void u16mediancola(uint16 *in, int row, int col, uint16* out) +{ + uint16 inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= u16mediana( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/u16medianrowa.c b/2.3-1/src/c/statisticsFunctions/median/u16medianrowa.c new file mode 100644 index 00000000..8e5b98ef --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/u16medianrowa.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 "median.h" +#include "types.h" +#include "uint16.h" + +void u16medianrowa(uint16 *in, int row, int col, uint16* out) +{ + uint16 inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= u16mediana( inter, row); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/zmediana.c b/2.3-1/src/c/statisticsFunctions/median/zmediana.c new file mode 100644 index 00000000..32726e77 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/zmediana.c @@ -0,0 +1,64 @@ +/* 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 "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +#include "addition.h" +#include "division.h" +#include "abs.h" + +doubleComplex zmediana(doubleComplex *in, int size) +{ + doubleComplex a; doubleComplex fin; doubleComplex middle; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (zabss(in[i]) > zabss(in[j])) + + { + + a = in[i]; + + in[i] = in[j]; + + in[j] = a; + + } + + } + + } + + + + if(size%2 ==0) + { + middle= zadds(in[size/2], in[(size/2)-1]); + fin= zrdivs(middle, DoubleComplex(2,0)); + } + else + { + fin= in[(size-1)/2]; + } + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/median/zmediancola.c b/2.3-1/src/c/statisticsFunctions/median/zmediancola.c new file mode 100644 index 00000000..d709d98b --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/zmediancola.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 "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void zmediancola(doubleComplex *in, int row, int col, doubleComplex * out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= zmediana( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/zmedianrowa.c b/2.3-1/src/c/statisticsFunctions/median/zmedianrowa.c new file mode 100644 index 00000000..ab2e0d4a --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/zmedianrowa.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 "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void zmedianrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= zmediana( inter, row); + + } + + +} |