diff options
author | Brijeshcr | 2017-07-20 14:01:36 +0530 |
---|---|---|
committer | GitHub | 2017-07-20 14:01:36 +0530 |
commit | b57f06d97f28704b8d9cc80b06e117d3d906d1d7 (patch) | |
tree | 4ee18ea99d187e38cccdac5fd3afaf7e825bba71 /2.3-1 | |
parent | 753a1302afb561e618d554b7d8b2c21e50562c43 (diff) | |
parent | 40913c177746aaf97d9fa62edb3c1ed9dc9873a5 (diff) | |
download | Scilab2C-b57f06d97f28704b8d9cc80b06e117d3d906d1d7.tar.gz Scilab2C-b57f06d97f28704b8d9cc80b06e117d3d906d1d7.tar.bz2 Scilab2C-b57f06d97f28704b8d9cc80b06e117d3d906d1d7.zip |
Merge pull request #20 from abhinavdronamraju/master
mad function added
Diffstat (limited to '2.3-1')
18 files changed, 440 insertions, 12 deletions
diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index a98181c4..5fecac83 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -604,6 +604,9 @@ extern "C" { /* interfacing median */ #include "median.h" #include "int_median.h" +/* interfacing mad */ +#include "mad.h" +#include "int_mad.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 ccb99610..be66237f 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 89ffc36f..aacc909a 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -1949,6 +1949,11 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'mad'; // 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);
diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index 95ec1e9f..6f9a272e 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -144,6 +144,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/statisticsFunctions/includes/sum.h" "src/c/statisticsFunctions/includes/mean.h" "src/c/statisticsFunctions/includes/median.h" + "src/c/statisticsFunctions/includes/mad.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 80043733..b826bb03 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -133,6 +133,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "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_mad.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 13371619..79bfd2bd 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -928,18 +928,27 @@ 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/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/mad/dmada.c" +"src/c/statisticsFunctions/mad/dmadrowa.c" +"src/c/statisticsFunctions/mad/dmadcola.c" +"src/c/statisticsFunctions/mad/smada.c" +"src/c/statisticsFunctions/mad/smadrowa.c" +"src/c/statisticsFunctions/mad/smadcola.c" +"src/c/statisticsFunctions/mad/zmada.c" +"src/c/statisticsFunctions/mad/zmadrowa.c" +"src/c/statisticsFunctions/mad/zmadcola.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/elementaryFunctions/type/gtype b/2.3-1/src/c/elementaryFunctions/type/gtype new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/type/gtype diff --git a/2.3-1/src/c/statisticsFunctions/includes/mad.h b/2.3-1/src/c/statisticsFunctions/includes/mad.h new file mode 100644 index 00000000..29032deb --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/includes/mad.h @@ -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 +*/ + + +#ifndef __MAD_H__ +#define __MAD_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmada(double* , int ); +void dmadrowa(double*, int, int, double*); +void dmadcola(double*, int, int, double*); + +float smada(float* , int ); +void smadrowa(float*, int, int, float*); +void smadcola(float*, int, int, float*); + +doubleComplex zmada(doubleComplex* , int ); +void zmadrowa(doubleComplex*, int, int, doubleComplex*); +void zmadcola(doubleComplex*, int, int, doubleComplex*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MAD_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/interfaces/int_mad.h b/2.3-1/src/c/statisticsFunctions/interfaces/int_mad.h new file mode 100644 index 00000000..956323da --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/interfaces/int_mad.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_MAD_H__ +#define __INT_MAD_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2madd0(in1, size) dmada(in1, size[0]* size[1]) +#define d2g2madd2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dmadrowa(in1, size1[0], size1[1], out) :dmadcola(in1, size1[0], size1[1], out) + +#define s2mads0(in1, size) smada(in1, size[0]* size[1]) +#define s2g2mads2(in1, size1, in2, size2, out) (in2[0]== 'r') ? smadrowa(in1, size1[0], size1[1], out) :smadcola(in1, size1[0], size1[1], out) + +#define z2madz0(in1, size) zmada(in1, size[0]* size[1]) +#define z2g2madz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? zmadrowa(in1, size1[0], size1[1], out) :zmadcola(in1, size1[0], size1[1], out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MAD_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/mad/dmada.c b/2.3-1/src/c/statisticsFunctions/mad/dmada.c new file mode 100644 index 00000000..907f78a8 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/dmada.c @@ -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 +*/ + + +#include "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +double dmada(double *in, int size) +{ + double fin = 0; double mean; + + mean= dmeana(in, size); + + for(int i=0; i< size; i++) + { + + fin = dadds(fin, dabss(mean-in[i])); + + } + +fin= fin/size; + + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/mad/dmadcola.c b/2.3-1/src/c/statisticsFunctions/mad/dmadcola.c new file mode 100644 index 00000000..381f85ca --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/dmadcola.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 "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void dmadcola(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]= dmada( inter, col); + + } +} diff --git a/2.3-1/src/c/statisticsFunctions/mad/dmadrowa.c b/2.3-1/src/c/statisticsFunctions/mad/dmadrowa.c new file mode 100644 index 00000000..2b47ba06 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/dmadrowa.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 "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void dmadrowa(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]= dmada( inter, row); + + } + +} diff --git a/2.3-1/src/c/statisticsFunctions/mad/smada.c b/2.3-1/src/c/statisticsFunctions/mad/smada.c new file mode 100644 index 00000000..241e337d --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/smada.c @@ -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 +*/ + + +#include "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +float smada(float *in, int size) +{ + float fin = 0; float mean; + + mean= smeana(in, size); + + for(int i=0; i< size; i++) + { + + fin = sadds(fin, sabss(mean-in[i])); + + } + +fin= fin/size; + + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/mad/smadcola.c b/2.3-1/src/c/statisticsFunctions/mad/smadcola.c new file mode 100644 index 00000000..c6f5e753 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/smadcola.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 "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void smadcola(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]= smada( inter, col); + + } +} diff --git a/2.3-1/src/c/statisticsFunctions/mad/smadrowa.c b/2.3-1/src/c/statisticsFunctions/mad/smadrowa.c new file mode 100644 index 00000000..3fbd917b --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/smadrowa.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 "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void smadrowa(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]= smada( inter, row); + + } + +} diff --git a/2.3-1/src/c/statisticsFunctions/mad/zmada.c b/2.3-1/src/c/statisticsFunctions/mad/zmada.c new file mode 100644 index 00000000..9531e3b7 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/zmada.c @@ -0,0 +1,40 @@ +/* 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 "mad.h" +#include "types.h" +#include "doubleComplex.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" +#include "subtraction.h" +#include "division.h" + +doubleComplex zmada(doubleComplex *in, int size) +{ + doubleComplex fin = DoubleComplex(0,0); doubleComplex mean; + + mean= zmeana(in, size); + + for(int i=0; i< size; i++) + { + + fin = zadds(fin, zabss(zdiffs(mean,in[i]))); + + } + +fin= zrdivs(fin,size); + + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/mad/zmadcola.c b/2.3-1/src/c/statisticsFunctions/mad/zmadcola.c new file mode 100644 index 00000000..a70841b3 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/zmadcola.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 "mad.h" +#include "types.h" +#include "doubleComplex.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void zmadcola(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]= zmada( inter, col); + + } +} diff --git a/2.3-1/src/c/statisticsFunctions/mad/zmadrowa.c b/2.3-1/src/c/statisticsFunctions/mad/zmadrowa.c new file mode 100644 index 00000000..c279322c --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mad/zmadrowa.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 "mad.h" +#include "types.h" +#include "doubleComplex.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void zmadrowa(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]= zmada( inter, row); + + } + +} |