From e837bc137eb35bd77e31530436d7727a500d45e0 Mon Sep 17 00:00:00 2001 From: Abhinav Dronamraju Date: Tue, 1 Aug 2017 20:22:53 +0530 Subject: Nanstdev, stdev, nancumsum added --- .../c/statisticsFunctions/nanstdev/dnanstdeva.c | 51 ++++++++++++++++++++++ .../c/statisticsFunctions/nanstdev/dnanstdevcola.c | 35 +++++++++++++++ .../c/statisticsFunctions/nanstdev/dnanstdevrowa.c | 36 +++++++++++++++ .../c/statisticsFunctions/nanstdev/snanstdeva.c | 51 ++++++++++++++++++++++ .../c/statisticsFunctions/nanstdev/snanstdevcola.c | 35 +++++++++++++++ .../c/statisticsFunctions/nanstdev/snanstdevrowa.c | 36 +++++++++++++++ 6 files changed, 244 insertions(+) create mode 100644 2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdeva.c create mode 100644 2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevcola.c create mode 100644 2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevrowa.c create mode 100644 2.3-1/src/c/statisticsFunctions/nanstdev/snanstdeva.c create mode 100644 2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevcola.c create mode 100644 2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevrowa.c (limited to '2.3-1/src/c/statisticsFunctions/nanstdev') diff --git a/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdeva.c b/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdeva.c new file mode 100644 index 00000000..05b54339 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdeva.c @@ -0,0 +1,51 @@ +/* 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 +#include +#include +#include "nanstdev.h" +#include "stdev.h" +#include "types.h" +double dnanstdeva(double* in, int size) +{ + +double temp[size]; +double out; +int j=0; + +double a= 0.0/0.0; + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + temp[j]= in[i]; + j=j+1; + + + } + + + } + + +out= dstdeva(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevcola.c b/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevcola.c new file mode 100644 index 00000000..a6704b09 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevcola.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 "nanstdev.h" +#include "types.h" +#include "uint16.h" + +void dnanstdevcola(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]= dnanstdeva( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevrowa.c b/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevrowa.c new file mode 100644 index 00000000..52a1722e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevrowa.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 "nanstdev.h" +#include "types.h" +#include "uint16.h" + +void dnanstdevrowa(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]= dnanstdeva( inter, row); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdeva.c b/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdeva.c new file mode 100644 index 00000000..3e6ab154 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdeva.c @@ -0,0 +1,51 @@ +/* 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 +#include +#include +#include "nanstdev.h" +#include "stdev.h" +#include "types.h" +float snanstdeva(float* in, int size) +{ + +float temp[size]; +float out; +int j=0; + +double a= 0.0/0.0; + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + temp[j]= in[i]; + j=j+1; + + + } + + + } + + +out= sstdeva(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevcola.c b/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevcola.c new file mode 100644 index 00000000..987cb3fd --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevcola.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 "nanstdev.h" +#include "types.h" +#include "uint16.h" + +void snanstdevcola(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]= snanstdeva( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevrowa.c b/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevrowa.c new file mode 100644 index 00000000..9c08682e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevrowa.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 "nanstdev.h" +#include "types.h" +#include "uint16.h" + +void snanstdevrowa(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]= snanstdeva( inter, row); + + } + + +} -- cgit