diff options
Diffstat (limited to 'src/c/elementaryFunctions/nanmean')
-rw-r--r-- | src/c/elementaryFunctions/nanmean/cnanmeana.c | 37 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/cnanmeancola.c | 37 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/cnanmeanrowa.c | 37 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/dnanmeana.c | 33 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/dnanmeancola.c | 36 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/dnanmeanrowa.c | 36 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/snanmeana.c | 33 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/snanmeancola.c | 35 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/snanmeanrowa.c | 35 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/znanmeana.c | 37 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/znanmeancola.c | 37 | ||||
-rw-r--r-- | src/c/elementaryFunctions/nanmean/znanmeanrowa.c | 37 |
12 files changed, 430 insertions, 0 deletions
diff --git a/src/c/elementaryFunctions/nanmean/cnanmeana.c b/src/c/elementaryFunctions/nanmean/cnanmeana.c new file mode 100644 index 0000000..eaca1e7 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/cnanmeana.c @@ -0,0 +1,37 @@ +/* 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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + + +floatComplex cnanmeana(floatComplex* in, int size) +{ + floatComplex sum = 0; + double count = 0; + + for(int i = 0; i<size; i++) + { + if(!(isnan(zreals(in[i]))) && !(isnan(zimags(in[i])))) + { + count++; + sum += in[i]; + } + } + + return sum/count; +} + diff --git a/src/c/elementaryFunctions/nanmean/cnanmeancola.c b/src/c/elementaryFunctions/nanmean/cnanmeancola.c new file mode 100644 index 0000000..7f643a6 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/cnanmeancola.c @@ -0,0 +1,37 @@ +/* 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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void cnanmeancola(floatComplex *in, int row, int col, floatComplex* out) +{ + floatComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= cnanmeana( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/cnanmeanrowa.c b/src/c/elementaryFunctions/nanmean/cnanmeanrowa.c new file mode 100644 index 0000000..05aa7e9 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/cnanmeanrowa.c @@ -0,0 +1,37 @@ +/* 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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void cnanmeanrowa(floatComplex *in, int row, int col, floatComplex* out) +{ + floatComplex inter[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= cnanmeana( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/dnanmeana.c b/src/c/elementaryFunctions/nanmean/dnanmeana.c new file mode 100644 index 0000000..40f9ac6 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/dnanmeana.c @@ -0,0 +1,33 @@ +/* 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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +double dnanmeana(double* in, int size) +{ + double count = 0, sum = 0; + + for(int i = 0; i<size; i++) + { + if(!(isnan(in[i]))) + { + count++; + sum += in[i]; + } + } + + return sum/count; +} + diff --git a/src/c/elementaryFunctions/nanmean/dnanmeancola.c b/src/c/elementaryFunctions/nanmean/dnanmeancola.c new file mode 100644 index 0000000..81ed533 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/dnanmeancola.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +void dnanmeancola(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]= dnanmeana( inter, col); + + } + + +} + diff --git a/src/c/elementaryFunctions/nanmean/dnanmeanrowa.c b/src/c/elementaryFunctions/nanmean/dnanmeanrowa.c new file mode 100644 index 0000000..1ac02f5 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/dnanmeanrowa.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +void dnanmeanrowa(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]= dnanmeana( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/snanmeana.c b/src/c/elementaryFunctions/nanmean/snanmeana.c new file mode 100644 index 0000000..aecf698 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/snanmeana.c @@ -0,0 +1,33 @@ +/* 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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +float snanmeana(float* in, int size) +{ + float count = 0, sum = 0; + + for(int i = 0; i<size; i++) + { + if(!(isnan(in[i]))) + { + count++; + sum += in[i]; + } + } + + return sum/count; +} + diff --git a/src/c/elementaryFunctions/nanmean/snanmeancola.c b/src/c/elementaryFunctions/nanmean/snanmeancola.c new file mode 100644 index 0000000..68df77b --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/snanmeancola.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +void snanmeancola(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]= snanmeana( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/snanmeanrowa.c b/src/c/elementaryFunctions/nanmean/snanmeanrowa.c new file mode 100644 index 0000000..1664aa4 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/snanmeanrowa.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +void snanmeanrowa(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]= snanmeana( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/znanmeana.c b/src/c/elementaryFunctions/nanmean/znanmeana.c new file mode 100644 index 0000000..366657a --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/znanmeana.c @@ -0,0 +1,37 @@ +/* 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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + + +doubleComplex znanmeana(doubleComplex* in, int size) +{ + doubleComplex sum = 0; + double count = 0; + + for(int i = 0; i<size; i++) + { + if(!(isnan(zreals(in[i]))) && !(isnan(zimags(in[i])))) + { + count++; + sum += in[i]; + } + } + + return sum/count; +} + diff --git a/src/c/elementaryFunctions/nanmean/znanmeancola.c b/src/c/elementaryFunctions/nanmean/znanmeancola.c new file mode 100644 index 0000000..28743e3 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/znanmeancola.c @@ -0,0 +1,37 @@ +/* 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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void znanmeancola(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]= znanmeana( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/znanmeanrowa.c b/src/c/elementaryFunctions/nanmean/znanmeanrowa.c new file mode 100644 index 0000000..8d80c77 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/znanmeanrowa.c @@ -0,0 +1,37 @@ +/* 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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void znanmeanrowa(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]= znanmeana( inter, row); + + } + + +} |