diff options
author | Abhinav Dronamraju | 2017-07-29 00:21:26 +0530 |
---|---|---|
committer | Abhinav Dronamraju | 2017-07-29 00:21:26 +0530 |
commit | 78c57c72c7532ea4abba4cb5d06ed34019a30c24 (patch) | |
tree | 7d1bdde8a9b590fde4233b8153bdf12d4d16913c /2.3-1/src/c/elementaryFunctions/nanmax | |
parent | cd41972eb98c3c69f74d6788e76e7789a846e53a (diff) | |
parent | 8398cac9dceebe7ae065b89dd0d39541acc11d5f (diff) | |
download | Scilab2C-78c57c72c7532ea4abba4cb5d06ed34019a30c24.tar.gz Scilab2C-78c57c72c7532ea4abba4cb5d06ed34019a30c24.tar.bz2 Scilab2C-78c57c72c7532ea4abba4cb5d06ed34019a30c24.zip |
Nan max few changes
Diffstat (limited to '2.3-1/src/c/elementaryFunctions/nanmax')
11 files changed, 320 insertions, 10 deletions
diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/dnanmax2a.c b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmax2a.c new file mode 100644 index 00000000..82ddda6b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmax2a.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +double dnanmax2a(double* in, int size, double* out) +{ +double high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + *out= i+1; + + } + + + } + + + } + + +return high; + +} diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcol1a.c b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcol1a.c new file mode 100644 index 00000000..1198dcea --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcol1a.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 "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxcol1a(double *in, int row, int col, double* out1) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out1[i]= dnanmaxa( inter, col); + + } + + +} diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcola.c b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcola.c index 9db07423..388337e7 100644 --- a/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcola.c +++ b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcola.c @@ -15,7 +15,7 @@ #include "types.h" #include "uint16.h" -void dnanmaxcola(double *in, int row, int col, double* out) +void dnanmaxcola(double *in, int row, int col, double* out1, double* out2) { double inter[col]; @@ -27,7 +27,7 @@ for(int i=0; i< row; i++) inter[j]= in[i+ (j*row)]; } - out[i]= dnanmaxa( inter, col); + out1[i]= dnanmax2a( inter, col, &out2[i]); } diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrow1a.c b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrow1a.c new file mode 100644 index 00000000..c4a7a4d1 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrow1a.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 "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxrow1a(double *in, int row, int col, double* out1) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out1[i]= dnanmaxa( inter, row); + + } + + + +} diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c index 191fa012..47d4d386 100644 --- a/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c +++ b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c @@ -15,9 +15,9 @@ #include "types.h" #include "uint16.h" -void dnanmaxrowa(double *in, int row, int col, double* out) +void dnanmaxrowa(double *in, int row, int col, double* out1, double* out2) { - double inter[row]; + double inter[row]; @@ -28,9 +28,10 @@ for(int i=0; i< col; i++) inter[j]= in[j+ (i*row)]; } - out[i]= dnanmaxa( inter, row); + out1[i]= dnanmax2a( inter, row, &out2[i]); } + } diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/snanmax1a.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmax1a.c new file mode 100644 index 00000000..7420c3a3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nanmax/snanmax1a.c @@ -0,0 +1,58 @@ +/* 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 "nanmax.h" +#include "types.h" +float snanmax1a(float* in, int row, int col, float* out) +{ +float high; +int ival=0; +for(int i=0; i<row*col; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< row*col; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + ival=i; + + } + + + } + + + } + +out[0]= ival%row +1; +out[1]= ival/row +1; + + + +return high; + +} diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/snanmax2a.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmax2a.c new file mode 100644 index 00000000..59c282d8 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nanmax/snanmax2a.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +float snanmax2a(float* in, int size, float* out) +{ +float high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + *out= i+1; + + } + + + } + + + } + + +return high; + +} diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcol1a.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcol1a.c new file mode 100644 index 00000000..a737033b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcol1a.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 "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxcol1a(float *in, int row, int col, float* out1) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out1[i]= snanmaxa( inter, col); + + } + + +} diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcola.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcola.c index b4080525..2703319a 100644 --- a/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcola.c +++ b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcola.c @@ -15,7 +15,7 @@ #include "types.h" #include "uint16.h" -void snanmaxcola(float *in, int row, int col, float* out) +void snanmaxcola(float *in, int row, int col, float* out1, float* out2) { float inter[col]; @@ -27,7 +27,7 @@ for(int i=0; i< row; i++) inter[j]= in[i+ (j*row)]; } - out[i]= snanmaxa( inter, col); + out1[i]= snanmax2a( inter, col, &out2[i]); } diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrow1a.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrow1a.c new file mode 100644 index 00000000..09d062c7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrow1a.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 "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxrow1a(float *in, int row, int col, float* out1) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out1[i]= snanmaxa( inter, row); + + } + + + +} diff --git a/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrowa.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrowa.c index ab1ce0cb..c438ae0f 100644 --- a/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrowa.c +++ b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrowa.c @@ -15,9 +15,9 @@ #include "types.h" #include "uint16.h" -void snanmaxrowa(float *in, int row, int col, float* out) +void snanmaxrowa(float *in, int row, int col, float* out1, float* out2) { - float inter[row]; + float inter[row]; @@ -28,9 +28,10 @@ for(int i=0; i< col; i++) inter[j]= in[j+ (i*row)]; } - out[i]= snanmaxa( inter, row); + out1[i]= snanmax2a( inter, row, &out2[i]); } + } |