summaryrefslogtreecommitdiff
path: root/src/c/elementaryFunctions/nanmin
diff options
context:
space:
mode:
authorAbhinav Dronamraju2017-07-29 00:21:26 +0530
committerAbhinav Dronamraju2017-07-29 00:21:26 +0530
commitddd322c2eca9f67013a6bc67a798f7a9978cd1d0 (patch)
tree1944ac0880df918c92def266f1f7496d5b182ce4 /src/c/elementaryFunctions/nanmin
parent9b3788e3f1b061bee62ad14c0bfbd7dfd64fbd01 (diff)
parentac3b1715d28643d9c8ba79a409adaf4196509ea7 (diff)
downloadScilab2C_fossee_old-ddd322c2eca9f67013a6bc67a798f7a9978cd1d0.tar.gz
Scilab2C_fossee_old-ddd322c2eca9f67013a6bc67a798f7a9978cd1d0.tar.bz2
Scilab2C_fossee_old-ddd322c2eca9f67013a6bc67a798f7a9978cd1d0.zip
Nan max few changes
Diffstat (limited to 'src/c/elementaryFunctions/nanmin')
-rw-r--r--src/c/elementaryFunctions/nanmin/dnanmina.c53
-rw-r--r--src/c/elementaryFunctions/nanmin/dnanmincola.c36
-rw-r--r--src/c/elementaryFunctions/nanmin/dnanmincolnpa.c36
-rw-r--r--src/c/elementaryFunctions/nanmin/dnanminnpa.c51
-rw-r--r--src/c/elementaryFunctions/nanmin/dnanminnps.c25
-rw-r--r--src/c/elementaryFunctions/nanmin/dnanminrowa.c36
-rw-r--r--src/c/elementaryFunctions/nanmin/dnanminrownpa.c36
-rw-r--r--src/c/elementaryFunctions/nanmin/dnanmins.c32
8 files changed, 305 insertions, 0 deletions
diff --git a/src/c/elementaryFunctions/nanmin/dnanmina.c b/src/c/elementaryFunctions/nanmin/dnanmina.c
new file mode 100644
index 0000000..f2bce00
--- /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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#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<row*col; i++)
+ {
+ if(!(isnan(in[i])))
+ {
+ low = in[i];
+ nanflag = 0;
+ break;
+ }
+ }
+
+ for(int i = 0; i<row*col; i++)
+ {
+ if(!(isnan(in[i])))
+ {
+ if(in[i]<low)
+ {
+ low = in[i];
+ ival = i;
+ }
+ }
+ }
+
+ pos[0] = ival % row + 1;
+ pos[1] = ival / row + 1;
+
+ if (nanflag == 1)
+ return 0.0/0.0;
+
+ return low;
+}
+
diff --git a/src/c/elementaryFunctions/nanmin/dnanmincola.c b/src/c/elementaryFunctions/nanmin/dnanmincola.c
new file mode 100644
index 0000000..0c4d202
--- /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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#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 0000000..3d1623c
--- /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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#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/dnanminnpa.c b/src/c/elementaryFunctions/nanmin/dnanminnpa.c
new file mode 100644
index 0000000..6456ebe
--- /dev/null
+++ b/src/c/elementaryFunctions/nanmin/dnanminnpa.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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "nanmin.h"
+
+double dnanminnpa(double* in, int row, int col)
+{
+ double low = 0;
+ int nanflag = 1;
+
+
+ for(int i = 0; i<row*col; i++)
+ {
+ if(!(isnan(in[i])))
+ {
+ low = in[i];
+ nanflag = 0;
+ break;
+ }
+ }
+
+ for(int i = 0; i<row*col; i++)
+ {
+ if(!(isnan(in[i])))
+ {
+ if(in[i]<low)
+ {
+ low = in[i];
+
+ }
+ }
+ }
+
+ if (nanflag == 1)
+ return 0.0/0.0;
+
+ return low;
+}
+
diff --git a/src/c/elementaryFunctions/nanmin/dnanminnps.c b/src/c/elementaryFunctions/nanmin/dnanminnps.c
new file mode 100644
index 0000000..9a33d2f
--- /dev/null
+++ b/src/c/elementaryFunctions/nanmin/dnanminnps.c
@@ -0,0 +1,25 @@
+/* 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 "nanmin.h"
+
+double dnanminnps(double in)
+{
+ if(isnan(in))
+ return 0;
+
+ return in;
+}
+
diff --git a/src/c/elementaryFunctions/nanmin/dnanminrowa.c b/src/c/elementaryFunctions/nanmin/dnanminrowa.c
new file mode 100644
index 0000000..d255ef1
--- /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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#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 0000000..fc46a0a
--- /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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#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);
+
+ }
+
+
+}
diff --git a/src/c/elementaryFunctions/nanmin/dnanmins.c b/src/c/elementaryFunctions/nanmin/dnanmins.c
new file mode 100644
index 0000000..86764a2
--- /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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#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;
+}
+