diff options
author | Brijeshcr | 2017-07-20 19:43:43 +0530 |
---|---|---|
committer | Brijeshcr | 2017-07-20 19:43:43 +0530 |
commit | e13b1a25161f2989946d6c9d0fd62fe15a6f480a (patch) | |
tree | 84e5c4da97aa935dbf47e3b685ee2e7bf1545245 /src | |
parent | 95ba66169e2f30d87694703b6162c58d371fceda (diff) | |
parent | 3debe3c52f32891b9b5716bc49db6809716180f5 (diff) | |
download | Scilab2C_fossee_old-e13b1a25161f2989946d6c9d0fd62fe15a6f480a.tar.gz Scilab2C_fossee_old-e13b1a25161f2989946d6c9d0fd62fe15a6f480a.tar.bz2 Scilab2C_fossee_old-e13b1a25161f2989946d6c9d0fd62fe15a6f480a.zip |
Pulled from remote
Diffstat (limited to 'src')
-rw-r--r-- | src/c/elementaryFunctions/type/gtype | 0 | ||||
-rw-r--r-- | src/c/statisticsFunctions/includes/mad.h | 42 | ||||
-rw-r--r-- | src/c/statisticsFunctions/interfaces/int_mad.h | 35 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/dmada.c | 38 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/dmadcola.c | 36 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/dmadrowa.c | 36 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/smada.c | 38 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/smadcola.c | 36 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/smadrowa.c | 36 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/zmada.c | 40 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/zmadcola.c | 36 | ||||
-rw-r--r-- | src/c/statisticsFunctions/mad/zmadrowa.c | 36 |
12 files changed, 409 insertions, 0 deletions
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); + + } + +} |