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 --- .../src/c/elementaryFunctions/includes/nancumsum.h | 42 ++++++++++++++++++++ .../elementaryFunctions/interfaces/int_nancumsum.h | 36 +++++++++++++++++ .../c/elementaryFunctions/nancumsum/dnancumsuma.c | 38 ++++++++++++++++++ .../elementaryFunctions/nancumsum/dnancumsumcola.c | 43 +++++++++++++++++++++ .../elementaryFunctions/nancumsum/dnancumsumrowa.c | 45 ++++++++++++++++++++++ .../c/elementaryFunctions/nancumsum/snancumsuma.c | 38 ++++++++++++++++++ .../elementaryFunctions/nancumsum/snancumsumcola.c | 43 +++++++++++++++++++++ .../elementaryFunctions/nancumsum/snancumsumrowa.c | 44 +++++++++++++++++++++ .../c/elementaryFunctions/nancumsum/znancumsuma.c | 39 +++++++++++++++++++ .../elementaryFunctions/nancumsum/znancumsumcola.c | 44 +++++++++++++++++++++ .../elementaryFunctions/nancumsum/znancumsumrowa.c | 45 ++++++++++++++++++++++ 11 files changed, 457 insertions(+) create mode 100644 2.3-1/src/c/elementaryFunctions/includes/nancumsum.h create mode 100644 2.3-1/src/c/elementaryFunctions/interfaces/int_nancumsum.h create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsuma.c create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsumcola.c create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsumrowa.c create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/snancumsuma.c create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/snancumsumcola.c create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/snancumsumrowa.c create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/znancumsuma.c create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/znancumsumcola.c create mode 100644 2.3-1/src/c/elementaryFunctions/nancumsum/znancumsumrowa.c (limited to '2.3-1/src/c/elementaryFunctions') diff --git a/2.3-1/src/c/elementaryFunctions/includes/nancumsum.h b/2.3-1/src/c/elementaryFunctions/includes/nancumsum.h new file mode 100644 index 00000000..48ccc96e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/nancumsum.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 __NANCUMSUM_H__ +#define __NANCUMSUM_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dnancumsuma(double* , int , double*); +void dnancumsumrowa(double*, int, int, double*); +void dnancumsumcola(double*, int, int, double*); + +void snancumsuma(float* , int, float* ); +void snancumsumrowa(float*, int, int, float*); +void snancumsumcola(float*, int, int, float*); + +void znancumsuma(doubleComplex* , int , doubleComplex*); +void znancumsumrowa(doubleComplex*, int, int, doubleComplex*); +void znancumsumcola(doubleComplex*, int, int, doubleComplex*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NANCUMSUM_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_nancumsum.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_nancumsum.h new file mode 100644 index 00000000..c82f6d65 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_nancumsum.h @@ -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 +*/ + +#ifndef __INT_NANCUMSUM_H__ +#define __INT_NANCUMSUM_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2nancumsumd2(in1, size, out) dnancumsuma(in1, size[0]* size[1], out) +#define d2g2nancumsumd2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dnancumsumrowa(in1, size1[0], size1[1], out) :dnancumsumcola(in1, size1[0], size1[1], out) + +#define s2nancumsums2(in1, size, out) snancumsuma(in1, size[0]* size[1], out) +#define s2g2nancumsums2(in1, size1, in2, size2, out) (in2[0]== 'r') ? snancumsumrowa(in1, size1[0], size1[1], out) :snancumsumcola(in1, size1[0], size1[1], out) + +#define z2nancumsumz2(in1, size, out) znancumsuma(in1, size[0]* size[1],out) +#define z2g2nancumsumz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? znancumsumrowa(in1, size1[0], size1[1], out) :znancumsumcola(in1, size1[0], size1[1], out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NANCUMSUM_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsuma.c b/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsuma.c new file mode 100644 index 00000000..135ab4bb --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsuma.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 "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void dnancumsuma(double *in, int size, double* out) +{ + double fin=0; + + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(in[i]))) + { + fin= dadds(fin, in[i]); + + } + out[i]= fin; + + } + + +} diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsumcola.c b/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsumcola.c new file mode 100644 index 00000000..a49b394d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsumcola.c @@ -0,0 +1,43 @@ +/* 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 "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void dnancumsumcola(double *in, int row, int col, double* out) +{ + double fin=0; + +for(int i=0; i< row; i++) + { + + for(int j= 0; j< col; j ++) + { + if(!(isnan(in[i+j*row]))) + + { + + fin = dadds(fin, in[i+j*row]); + + + + } + out[i+j*row]= fin; + + } + fin=0; + + } +} diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsumrowa.c b/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsumrowa.c new file mode 100644 index 00000000..45ce1ca2 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/dnancumsumrowa.c @@ -0,0 +1,45 @@ +/* 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 "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void dnancumsumrowa(double *in, int row, int col, double* out) +{ + + double fin=0; + + +for(int i=0; i< col; i++) + { + + for(int j= 0; j< row; j ++) + { + if(!(isnan(in[j+i*row]))) + + { + + fin = dadds(fin, in[j+i*row]); + + + + } + out[j+i*row]= fin; + + } + fin=0; + + } +} diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsuma.c b/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsuma.c new file mode 100644 index 00000000..56d16335 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsuma.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 "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void snancumsuma(float *in, int size, float* out) +{ + float fin=0; + + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(in[i]))) + { + fin= sadds(fin, in[i]); + + } + out[i]= fin; + + } + + +} diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsumcola.c b/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsumcola.c new file mode 100644 index 00000000..3b96ef01 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsumcola.c @@ -0,0 +1,43 @@ +/* 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 "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void snancumsumcola(float *in, int row, int col, float* out) +{ + float fin=0; + +for(int i=0; i< row; i++) + { + + for(int j= 0; j< col; j ++) + { + if(!(isnan(in[i+j*row]))) + + { + + fin = sadds(fin, in[i+j*row]); + + + + } + out[i+j*row]= fin; + + } + fin=0; + + } +} diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsumrowa.c b/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsumrowa.c new file mode 100644 index 00000000..7eef3869 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/snancumsumrowa.c @@ -0,0 +1,44 @@ +/* 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 "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void snancumsumrowa(float *in, int row, int col, float* out) +{ + float fin=0; + + +for(int i=0; i< col; i++) + { + + for(int j= 0; j< row; j ++) + { + if(!(isnan(in[j+i*row]))) + + { + + fin = sadds(fin, in[j+i*row]); + + + + } + out[j+i*row]= fin; + + } + fin=0; + + } +} diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsuma.c b/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsuma.c new file mode 100644 index 00000000..fd0a1e3e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsuma.c @@ -0,0 +1,39 @@ +/* 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 "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +#include "addition.h" + +void znancumsuma(doubleComplex *in, int size, doubleComplex* out) +{ + doubleComplex fin=0; + + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(zreals(in[i]))) && !(isnan(zimags(in[i]))) ) + { + fin= zadds(fin, in[i]); + + } + out[i]= fin; + + } + + +} diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsumcola.c b/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsumcola.c new file mode 100644 index 00000000..c1ca16b6 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsumcola.c @@ -0,0 +1,44 @@ +/* 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 "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" +#include "doubleComplex.h" + +void znancumsumcola(doubleComplex* in, int row, int col, doubleComplex* out) +{ + doubleComplex fin= 0; + +for(int i=0; i< row; i++) + { + + for(int j= 0; j< col; j ++) + { + if( !(isnan(zreals(in[i+j*row]))) && !(isnan(zimags(in[i+j*row]))) ) + + { + + fin = zadds(fin, in[i+j*row]); + + + + } + out[i+j*row]= fin; + + } + fin= 0; + + } +} diff --git a/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsumrowa.c b/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsumrowa.c new file mode 100644 index 00000000..be04a4a7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nancumsum/znancumsumrowa.c @@ -0,0 +1,45 @@ +/* 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 "nancumsum.h" +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" +#include "addition.h" + +void znancumsumrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex fin=0; + + +for(int i=0; i< col; i++) + { + + for(int j= 0; j< row; j ++) + { + if(!(isnan(zreals(in[j+i*row]))) && !(isnan(zimags(in[j+i*row]))) ) + + { + + fin = zadds(fin, in[j+i*row]); + + + + } + out[j+i*row]= fin; + + } + fin=0; + + } +} -- cgit