diff options
Diffstat (limited to 'src/c/statisticsFunctions/nanmedian')
-rw-r--r-- | src/c/statisticsFunctions/nanmedian/dnanmediana.c | 51 | ||||
-rw-r--r-- | src/c/statisticsFunctions/nanmedian/dnanmediancola.c | 35 | ||||
-rw-r--r-- | src/c/statisticsFunctions/nanmedian/dnanmedianrowa.c | 36 | ||||
-rw-r--r-- | src/c/statisticsFunctions/nanmedian/snanmediana.c | 49 | ||||
-rw-r--r-- | src/c/statisticsFunctions/nanmedian/snanmediancola.c | 36 | ||||
-rw-r--r-- | src/c/statisticsFunctions/nanmedian/snanmedianrowa.c | 37 |
6 files changed, 244 insertions, 0 deletions
diff --git a/src/c/statisticsFunctions/nanmedian/dnanmediana.c b/src/c/statisticsFunctions/nanmedian/dnanmediana.c new file mode 100644 index 0000000..0fb7de1 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/dnanmediana.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 "nanmedian.h" +#include "median.h" +#include "types.h" +double dnanmediana(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= dmediana(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/src/c/statisticsFunctions/nanmedian/dnanmediancola.c b/src/c/statisticsFunctions/nanmedian/dnanmediancola.c new file mode 100644 index 0000000..37b3f12 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/dnanmediancola.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 "nanmedian.h" +#include "types.h" +#include "uint16.h" + +void dnanmediancola(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]= dnanmediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/nanmedian/dnanmedianrowa.c b/src/c/statisticsFunctions/nanmedian/dnanmedianrowa.c new file mode 100644 index 0000000..d24ba82 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/dnanmedianrowa.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 "nanmedian.h" +#include "types.h" +#include "uint16.h" + +void dnanmedianrowa(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]= dnanmediana( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/nanmedian/snanmediana.c b/src/c/statisticsFunctions/nanmedian/snanmediana.c new file mode 100644 index 0000000..cddb990 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/snanmediana.c @@ -0,0 +1,49 @@ +/* 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 "nanmedian.h" +#include "median.h" +#include "types.h" +float snanmediana(float* in, int size) +{ + +float temp[size]; +float out; +int j=0; + +float a= 0.0/0.0; + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + temp[j]= in[i]; + j=j+1; + + + } + + + } + + +out= smediana(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/src/c/statisticsFunctions/nanmedian/snanmediancola.c b/src/c/statisticsFunctions/nanmedian/snanmediancola.c new file mode 100644 index 0000000..a8077f1 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/snanmediancola.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 "nanmedian.h" +#include "mean.h" +#include "types.h" +#include "uint16.h" + +void snanmediancola(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]= snanmediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/nanmedian/snanmedianrowa.c b/src/c/statisticsFunctions/nanmedian/snanmedianrowa.c new file mode 100644 index 0000000..47425e0 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/snanmedianrowa.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmedian.h" +#include "mean.h" +#include "types.h" +#include "uint16.h" + +void snanmedianrowa(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]= snanmediana( inter, row); + + } + + +} |