summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhinav Dronamraju2017-07-18 21:12:29 +0530
committerAbhinav Dronamraju2017-07-18 21:12:29 +0530
commit3debe3c52f32891b9b5716bc49db6809716180f5 (patch)
treecbfa3f6952fb8cb906f57466dfb09cd9d043d61f
parent70ec68c70d86edcf17f3ab5aa74a4598d48c0fc8 (diff)
downloadScilab2C_fossee_old-3debe3c52f32891b9b5716bc49db6809716180f5.tar.gz
Scilab2C_fossee_old-3debe3c52f32891b9b5716bc49db6809716180f5.tar.bz2
Scilab2C_fossee_old-3debe3c52f32891b9b5716bc49db6809716180f5.zip
ad function added
-rw-r--r--includes/sci2clib.h3
-rw-r--r--jar/scilab_en_US_help.jarbin11210 -> 11210 bytes
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci5
-rw-r--r--macros/findDeps/getAllHeaders.sci1
-rw-r--r--macros/findDeps/getAllInterfaces.sci1
-rw-r--r--macros/findDeps/getAllSources.sci33
-rw-r--r--src/c/elementaryFunctions/type/gtype0
-rw-r--r--src/c/statisticsFunctions/includes/mad.h42
-rw-r--r--src/c/statisticsFunctions/interfaces/int_mad.h35
-rw-r--r--src/c/statisticsFunctions/mad/dmada.c38
-rw-r--r--src/c/statisticsFunctions/mad/dmadcola.c36
-rw-r--r--src/c/statisticsFunctions/mad/dmadrowa.c36
-rw-r--r--src/c/statisticsFunctions/mad/smada.c38
-rw-r--r--src/c/statisticsFunctions/mad/smadcola.c36
-rw-r--r--src/c/statisticsFunctions/mad/smadrowa.c36
-rw-r--r--src/c/statisticsFunctions/mad/zmada.c40
-rw-r--r--src/c/statisticsFunctions/mad/zmadcola.c36
-rw-r--r--src/c/statisticsFunctions/mad/zmadrowa.c36
18 files changed, 440 insertions, 12 deletions
diff --git a/includes/sci2clib.h b/includes/sci2clib.h
index a98181c..5fecac8 100644
--- a/includes/sci2clib.h
+++ b/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/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar
index ccb9961..be66237 100644
--- a/jar/scilab_en_US_help.jar
+++ b/jar/scilab_en_US_help.jar
Binary files differ
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index 89ffc36..aacc909 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/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/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci
index 95ec1e9..6f9a272 100644
--- a/macros/findDeps/getAllHeaders.sci
+++ b/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/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci
index 8004373..b826bb0 100644
--- a/macros/findDeps/getAllInterfaces.sci
+++ b/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/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci
index 1337161..79bfd2b 100644
--- a/macros/findDeps/getAllSources.sci
+++ b/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/src/c/elementaryFunctions/type/gtype b/src/c/elementaryFunctions/type/gtype
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/c/elementaryFunctions/type/gtype
diff --git a/src/c/statisticsFunctions/includes/mad.h b/src/c/statisticsFunctions/includes/mad.h
new file mode 100644
index 0000000..29032de
--- /dev/null
+++ b/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/src/c/statisticsFunctions/interfaces/int_mad.h b/src/c/statisticsFunctions/interfaces/int_mad.h
new file mode 100644
index 0000000..956323d
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/dmada.c b/src/c/statisticsFunctions/mad/dmada.c
new file mode 100644
index 0000000..907f78a
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/dmadcola.c b/src/c/statisticsFunctions/mad/dmadcola.c
new file mode 100644
index 0000000..381f85c
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/dmadrowa.c b/src/c/statisticsFunctions/mad/dmadrowa.c
new file mode 100644
index 0000000..2b47ba0
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/smada.c b/src/c/statisticsFunctions/mad/smada.c
new file mode 100644
index 0000000..241e337
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/smadcola.c b/src/c/statisticsFunctions/mad/smadcola.c
new file mode 100644
index 0000000..c6f5e75
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/smadrowa.c b/src/c/statisticsFunctions/mad/smadrowa.c
new file mode 100644
index 0000000..3fbd917
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/zmada.c b/src/c/statisticsFunctions/mad/zmada.c
new file mode 100644
index 0000000..9531e3b
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/zmadcola.c b/src/c/statisticsFunctions/mad/zmadcola.c
new file mode 100644
index 0000000..a70841b
--- /dev/null
+++ b/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/src/c/statisticsFunctions/mad/zmadrowa.c b/src/c/statisticsFunctions/mad/zmadrowa.c
new file mode 100644
index 0000000..c279322
--- /dev/null
+++ b/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);
+
+ }
+
+}