From 4bd28238003609980b66edbd25dae9239a237843 Mon Sep 17 00:00:00 2001 From: Brijeshcr Date: Thu, 27 Jul 2017 18:29:25 +0530 Subject: Nanmin and Nanmean added --- src/c/elementaryFunctions/includes/nanmean.h | 42 +++++++++++++++++ src/c/elementaryFunctions/includes/nanmin.h | 37 +++++++++++++++ src/c/elementaryFunctions/interfaces/int_nanmean.h | 32 +++++++++++++ src/c/elementaryFunctions/interfaces/int_nanmin.h | 29 ++++++++++++ src/c/elementaryFunctions/nanmean/cnanmeana.c | 37 +++++++++++++++ src/c/elementaryFunctions/nanmean/cnanmeancola.c | 37 +++++++++++++++ src/c/elementaryFunctions/nanmean/cnanmeanrowa.c | 37 +++++++++++++++ src/c/elementaryFunctions/nanmean/dnanmeana.c | 33 ++++++++++++++ src/c/elementaryFunctions/nanmean/dnanmeancola.c | 36 +++++++++++++++ src/c/elementaryFunctions/nanmean/dnanmeanrowa.c | 36 +++++++++++++++ src/c/elementaryFunctions/nanmean/snanmeana.c | 33 ++++++++++++++ src/c/elementaryFunctions/nanmean/snanmeancola.c | 35 ++++++++++++++ src/c/elementaryFunctions/nanmean/snanmeanrowa.c | 35 ++++++++++++++ src/c/elementaryFunctions/nanmean/znanmeana.c | 37 +++++++++++++++ src/c/elementaryFunctions/nanmean/znanmeancola.c | 37 +++++++++++++++ src/c/elementaryFunctions/nanmean/znanmeanrowa.c | 37 +++++++++++++++ src/c/elementaryFunctions/nanmin/dnanmina.c | 53 ++++++++++++++++++++++ src/c/elementaryFunctions/nanmin/dnanminnpa.c | 51 +++++++++++++++++++++ src/c/elementaryFunctions/nanmin/dnanminnps.c | 25 ++++++++++ src/c/elementaryFunctions/nanmin/dnanmins.c | 32 +++++++++++++ src/c/signalProcessing/includes/dct.h | 2 +- src/c/signalProcessing/interfaces/int_dct.h | 4 +- 22 files changed, 734 insertions(+), 3 deletions(-) create mode 100644 src/c/elementaryFunctions/includes/nanmean.h create mode 100644 src/c/elementaryFunctions/includes/nanmin.h create mode 100644 src/c/elementaryFunctions/interfaces/int_nanmean.h create mode 100644 src/c/elementaryFunctions/interfaces/int_nanmin.h create mode 100644 src/c/elementaryFunctions/nanmean/cnanmeana.c create mode 100644 src/c/elementaryFunctions/nanmean/cnanmeancola.c create mode 100644 src/c/elementaryFunctions/nanmean/cnanmeanrowa.c create mode 100644 src/c/elementaryFunctions/nanmean/dnanmeana.c create mode 100644 src/c/elementaryFunctions/nanmean/dnanmeancola.c create mode 100644 src/c/elementaryFunctions/nanmean/dnanmeanrowa.c create mode 100644 src/c/elementaryFunctions/nanmean/snanmeana.c create mode 100644 src/c/elementaryFunctions/nanmean/snanmeancola.c create mode 100644 src/c/elementaryFunctions/nanmean/snanmeanrowa.c create mode 100644 src/c/elementaryFunctions/nanmean/znanmeana.c create mode 100644 src/c/elementaryFunctions/nanmean/znanmeancola.c create mode 100644 src/c/elementaryFunctions/nanmean/znanmeanrowa.c create mode 100644 src/c/elementaryFunctions/nanmin/dnanmina.c create mode 100644 src/c/elementaryFunctions/nanmin/dnanminnpa.c create mode 100644 src/c/elementaryFunctions/nanmin/dnanminnps.c create mode 100644 src/c/elementaryFunctions/nanmin/dnanmins.c (limited to 'src') diff --git a/src/c/elementaryFunctions/includes/nanmean.h b/src/c/elementaryFunctions/includes/nanmean.h new file mode 100644 index 00000000..097fec4e --- /dev/null +++ b/src/c/elementaryFunctions/includes/nanmean.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __NANMEAN_H__ +#define __NANMEAN_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanmeana(double* in, int size); +void dnanmeancola(double *in, int row, int col, double* out); +void dnanmeanrowa(double *in, int row, int col, double* out); + +float snanmeana(float* in, int size); +void snanmeancola(float *in, int row, int col, float* out); +void snanmeanrowa(float *in, int row, int col, float* out); + +doubleComplex znanmeana(doubleComplex* in, int size); +void znanmeancola(doubleComplex *in, int row, int col, doubleComplex* out); +void znanmeanrowa(doubleComplex *in, int row, int col, doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NANMEAN_H__*/ diff --git a/src/c/elementaryFunctions/includes/nanmin.h b/src/c/elementaryFunctions/includes/nanmin.h new file mode 100644 index 00000000..ba71bb0b --- /dev/null +++ b/src/c/elementaryFunctions/includes/nanmin.h @@ -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 +*/ + +#ifndef __NANMIN_H__ +#define __NANMIN_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanmina(double* in, int row, int col, double* pos); +double dnanminnpa(double* in, int row, int col); +double dnanmins(double in, double* pos); +double dnanminnps(double in); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NANMIN_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_nanmean.h b/src/c/elementaryFunctions/interfaces/int_nanmean.h new file mode 100644 index 00000000..0195b0d3 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nanmean.h @@ -0,0 +1,32 @@ + /*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 +*/ + +#ifndef __INT_NANMEAN_H__ +#define __INT_NANMEAN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d2nanmeand0(in1, size) dnanmeana(in1,size[0]* size[1]) +#define d2g2nanmeand2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanmeanrowa(in1, size1[0], size1[1], out) : dnanmeancola(in1, size1[0] , size1[1], out) + +#define s2nanmeans0(in1, size) snanmeana(in1,size[0]* size[1]) +#define s2g2nanmeans2(in1, size1, in2, size2, out) (in2[0]=='r') ? snanmeanrowa(in1, size1[0], size1[1], out) : snanmeancola(in1, size1[0] , size1[1], out) + +#define z2nanmeanz0(in1, size) znanmeana(in1,size[0]* size[1]) +#define z2g2nanmeanz2(in1, size1, in2, size2, out) (in2[0]=='r') ? znanmeanrowa(in1, size1[0], size1[1], out) : znanmeancola(in1, size1[0] , size1[1], out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NANMEAN_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_nanmin.h b/src/c/elementaryFunctions/interfaces/int_nanmin.h new file mode 100644 index 00000000..4e8018a9 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nanmin.h @@ -0,0 +1,29 @@ + /*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 +*/ + +#ifndef __INT_NANMIN_H__ +#define __INT_NANMIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d2nanmind0d2(in1, size, pos) dnanmina(in1,size[0], size[1], pos) +#define d2nanmind0(in1, size) dnanminnpa(in1,size[0], size[1]) +#define d0nanmind0d2(in1, pos) dnanmins(in1, pos) +#define d0nanmind0(in1) dnanminnps(in1) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NANMIN_H__*/ diff --git a/src/c/elementaryFunctions/nanmean/cnanmeana.c b/src/c/elementaryFunctions/nanmean/cnanmeana.c new file mode 100644 index 00000000..eaca1e79 --- /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 +#include +#include +#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 +#include +#include +#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 00000000..05aa7e93 --- /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 +#include +#include +#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 00000000..40f9ac6f --- /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 +#include +#include +#include "nanmean.h" + +double dnanmeana(double* in, int size) +{ + double count = 0, sum = 0; + + for(int i = 0; i +#include +#include +#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 00000000..1ac02f5f --- /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 +#include +#include +#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 00000000..aecf6984 --- /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 +#include +#include +#include "nanmean.h" + +float snanmeana(float* in, int size) +{ + float count = 0, sum = 0; + + for(int i = 0; i +#include +#include +#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 00000000..1664aa4e --- /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 +#include +#include +#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 00000000..366657a5 --- /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 +#include +#include +#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 +#include +#include +#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 00000000..8d80c779 --- /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 +#include +#include +#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); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmin/dnanmina.c b/src/c/elementaryFunctions/nanmin/dnanmina.c new file mode 100644 index 00000000..f2bce003 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanmina.c @@ -0,0 +1,53 @@ +/* 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 +#include +#include +#include "nanmin.h" + +double dnanmina(double* in, int row, int col, double* pos) +{ + double low = 0; + int ival = 0, nanflag = 1; + + for(int i = 0; i +#include +#include +#include "nanmin.h" + +double dnanminnpa(double* in, int row, int col) +{ + double low = 0; + int nanflag = 1; + + + for(int i = 0; i +#include +#include +#include "nanmin.h" + +double dnanminnps(double in) +{ + if(isnan(in)) + return 0; + + return in; +} + diff --git a/src/c/elementaryFunctions/nanmin/dnanmins.c b/src/c/elementaryFunctions/nanmin/dnanmins.c new file mode 100644 index 00000000..86764a2a --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanmins.c @@ -0,0 +1,32 @@ +/* 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 +#include +#include +#include "nanmin.h" + +double dnanmins(double in, double* pos) +{ + pos[0] = 1; + pos[1] = 1; + + if(isnan(in)) + { + pos[0] = 0; + pos[1] = 0; + return 0; + } + + return in; +} + diff --git a/src/c/signalProcessing/includes/dct.h b/src/c/signalProcessing/includes/dct.h index db95274b..80668ffa 100644 --- a/src/c/signalProcessing/includes/dct.h +++ b/src/c/signalProcessing/includes/dct.h @@ -29,7 +29,7 @@ void sdcta(float *in,int row,int col,int sign,float *out); void zdcta(doubleComplex *in,int row,int col,int sign,doubleComplex *out); -//void cdcta(floatComplex *in,int row,int col,int sign,floatComplex *out); +void cdcta(floatComplex *in,int row,int col,int sign,floatComplex *out); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/signalProcessing/interfaces/int_dct.h b/src/c/signalProcessing/interfaces/int_dct.h index ef58b48e..3481c4d5 100644 --- a/src/c/signalProcessing/interfaces/int_dct.h +++ b/src/c/signalProcessing/interfaces/int_dct.h @@ -29,8 +29,8 @@ #define z2d0dctz2(in,size,sign,out) zdcta(in,size[0],size[1],sign,out) -//#define c2dctc2(in,size,out) cdcta(in,size[0],size[1],-1,out) +#define c2dctc2(in,size,out) cdcta(in,size[0],size[1],-1,out) -//#define c2s0dctc2(in,size,sign,out) cdcta(in,size[0],size[1],sign,out) +#define c2s0dctc2(in,size,sign,out) cdcta(in,size[0],size[1],sign,out) #endif -- cgit From ac3b1715d28643d9c8ba79a409adaf4196509ea7 Mon Sep 17 00:00:00 2001 From: Brijeshcr Date: Thu, 27 Jul 2017 20:33:40 +0530 Subject: Updated Nanmin --- src/c/elementaryFunctions/includes/nanmin.h | 4 +++ src/c/elementaryFunctions/interfaces/int_nanmin.h | 2 ++ src/c/elementaryFunctions/nanmin/dnanmincola.c | 36 +++++++++++++++++++++++ src/c/elementaryFunctions/nanmin/dnanmincolnpa.c | 36 +++++++++++++++++++++++ src/c/elementaryFunctions/nanmin/dnanminrowa.c | 36 +++++++++++++++++++++++ src/c/elementaryFunctions/nanmin/dnanminrownpa.c | 36 +++++++++++++++++++++++ 6 files changed, 150 insertions(+) create mode 100644 src/c/elementaryFunctions/nanmin/dnanmincola.c create mode 100644 src/c/elementaryFunctions/nanmin/dnanmincolnpa.c create mode 100644 src/c/elementaryFunctions/nanmin/dnanminrowa.c create mode 100644 src/c/elementaryFunctions/nanmin/dnanminrownpa.c (limited to 'src') diff --git a/src/c/elementaryFunctions/includes/nanmin.h b/src/c/elementaryFunctions/includes/nanmin.h index ba71bb0b..adeff6b5 100644 --- a/src/c/elementaryFunctions/includes/nanmin.h +++ b/src/c/elementaryFunctions/includes/nanmin.h @@ -28,6 +28,10 @@ double dnanminnpa(double* in, int row, int col); double dnanmins(double in, double* pos); double dnanminnps(double in); +void dnanminrownpa(double *in, int row, int col, double* out); +void dnanmincolnpa(double *in, int row, int col, double* out); + + #ifdef __cplusplus diff --git a/src/c/elementaryFunctions/interfaces/int_nanmin.h b/src/c/elementaryFunctions/interfaces/int_nanmin.h index 4e8018a9..408dac65 100644 --- a/src/c/elementaryFunctions/interfaces/int_nanmin.h +++ b/src/c/elementaryFunctions/interfaces/int_nanmin.h @@ -21,6 +21,8 @@ extern "C" { #define d0nanmind0d2(in1, pos) dnanmins(in1, pos) #define d0nanmind0(in1) dnanminnps(in1) +#define d2g2nanmind2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanminrownpa(in1, size1[0], size1[1], out) : dnanmincolnpa(in1, size1[0] , size1[1], out) +//#define d2g2nanmind2d2(in1, size1, in2, size2, p, out) (in2[0]=='r') ? dnanminrowa(in1, size1[0], size1[1], p, out) : dnanmincola(in1, size1[0] , size1[1], p, out) #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/elementaryFunctions/nanmin/dnanmincola.c b/src/c/elementaryFunctions/nanmin/dnanmincola.c new file mode 100644 index 00000000..0c4d202f --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanmincola.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 +#include +#include +#include "nanmin.h" + +void dnanmincola(double *in, int row, int col, double *p, 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]= dnanmina( inter, 1, col, p); + + } + + +} + diff --git a/src/c/elementaryFunctions/nanmin/dnanmincolnpa.c b/src/c/elementaryFunctions/nanmin/dnanmincolnpa.c new file mode 100644 index 00000000..3d1623c2 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanmincolnpa.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 +#include +#include +#include "nanmin.h" + +void dnanmincolnpa(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]= dnanminnpa( inter, 1, col); + + } + + +} + diff --git a/src/c/elementaryFunctions/nanmin/dnanminrowa.c b/src/c/elementaryFunctions/nanmin/dnanminrowa.c new file mode 100644 index 00000000..d255ef14 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanminrowa.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 +#include +#include +#include "nanmin.h" + +void dnanminrowa(double *in, int row, int col, double *p, 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]= dnanmina( inter, row, 1, p); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmin/dnanminrownpa.c b/src/c/elementaryFunctions/nanmin/dnanminrownpa.c new file mode 100644 index 00000000..fc46a0a4 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanminrownpa.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 +#include +#include +#include "nanmin.h" + +void dnanminrownpa(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]= dnanminnpa( inter, row, 1); + + } + + +} -- cgit