summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/statisticsFunctions/nanstdev
diff options
context:
space:
mode:
authorAbhinav Dronamraju2017-08-01 20:22:53 +0530
committerAbhinav Dronamraju2017-08-01 20:22:53 +0530
commite837bc137eb35bd77e31530436d7727a500d45e0 (patch)
treee39bf9d85039ac33be87b8ad8661944e9a7327fa /2.3-1/src/c/statisticsFunctions/nanstdev
parent81419aa6b4f55ae75192f704d2e52dbad3f34033 (diff)
downloadScilab2C-e837bc137eb35bd77e31530436d7727a500d45e0.tar.gz
Scilab2C-e837bc137eb35bd77e31530436d7727a500d45e0.tar.bz2
Scilab2C-e837bc137eb35bd77e31530436d7727a500d45e0.zip
Nanstdev, stdev, nancumsum added
Diffstat (limited to '2.3-1/src/c/statisticsFunctions/nanstdev')
-rw-r--r--2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdeva.c51
-rw-r--r--2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevcola.c35
-rw-r--r--2.3-1/src/c/statisticsFunctions/nanstdev/dnanstdevrowa.c36
-rw-r--r--2.3-1/src/c/statisticsFunctions/nanstdev/snanstdeva.c51
-rw-r--r--2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevcola.c35
-rw-r--r--2.3-1/src/c/statisticsFunctions/nanstdev/snanstdevrowa.c36
6 files changed, 244 insertions, 0 deletions
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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#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);
+
+ }
+
+
+}