summaryrefslogtreecommitdiff
path: root/src/c/elementaryFunctions
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/elementaryFunctions')
-rw-r--r--src/c/elementaryFunctions/interfaces/int_nanmax.h5
-rw-r--r--src/c/elementaryFunctions/nanmax/dnanmax1a.c (renamed from src/c/elementaryFunctions/nanmax/znanmaxa.c)25
-rw-r--r--src/c/elementaryFunctions/nanmax/znanmaxcola.c36
-rw-r--r--src/c/elementaryFunctions/nanmax/znanmaxrowa.c37
4 files changed, 16 insertions, 87 deletions
diff --git a/src/c/elementaryFunctions/interfaces/int_nanmax.h b/src/c/elementaryFunctions/interfaces/int_nanmax.h
index dd3df71d..45dd55e5 100644
--- a/src/c/elementaryFunctions/interfaces/int_nanmax.h
+++ b/src/c/elementaryFunctions/interfaces/int_nanmax.h
@@ -13,8 +13,9 @@
#ifndef __INT_NANMAX_H__
#define __INT_NANMAX_H__
-#define d2nanmaxd0(in1, size) dnanmaxa(in1,size[0]* size[1])
-#define d2g2nanmaxd2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanmaxrowa(in1, size1[0], size1[1], out) : dnanmaxcola(in1, size1[0] , size1[1], out)
+#define d2nanmaxd0(in1, size) dnanmaxa(in1,size[0]* size[1])
+//#define d2nanmaxd0d2(in1, size, out) dnanmaxa(in1,size[0], size[1], out)
+#define d2g2nanmaxd2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanmaxrowa(in1, size1[0], size1[1], out) : dnanmaxcola(in1, size1[0] , size1[1], out)
#define s2nanmaxs0(in1, size) snanmaxa(in1,size[0]* size[1])
#define s2g2nanmaxs2(in1, size1, in2, size2, out) (in2[0]=='r') ? snanmaxrowa(in1, size1[0], size1[1], out) : snanmaxcola(in1, size1[0] , size1[1], out)
diff --git a/src/c/elementaryFunctions/nanmax/znanmaxa.c b/src/c/elementaryFunctions/nanmax/dnanmax1a.c
index 6283bf16..a0e7eede 100644
--- a/src/c/elementaryFunctions/nanmax/znanmaxa.c
+++ b/src/c/elementaryFunctions/nanmax/dnanmax1a.c
@@ -15,31 +15,30 @@
#include <math.h>
#include "nanmax.h"
#include "types.h"
-#include "doubleComplex.h"
-#include "abs.h"
-
-doubleComplex znanmaxa(doubleComplex* in, int size)
+double dnanmax1a(double* in, int row, int col, double* out)
{
-doubleComplex high=0; int k=0;
-for(int i=0; i<size; i++)
+double high;
+int ival=0;
+for(int i=0; i<row*col; i++)
{
if( !(isnan(in[i])) )
{
high= in[i];
break;
- k= 1;
+
}
}
- for(int i=0; i< size; i++)
+ for(int i=0; i< row*col; i++)
{
if( !(isnan(in[i])) )
{
- if( zabss(in[i]) > zabss(high))
+ if( in[i] > high)
{
high= in[i];
+ ival=i;
}
@@ -48,10 +47,12 @@ for(int i=0; i<size; i++)
}
+
+out[0]= ival%row +1;
+out[1]= ival/row +1;
-if(k != 0)
+
return high;
-else
-return - 0.0/0.0;
+
}
diff --git a/src/c/elementaryFunctions/nanmax/znanmaxcola.c b/src/c/elementaryFunctions/nanmax/znanmaxcola.c
deleted file mode 100644
index ffb96b20..00000000
--- a/src/c/elementaryFunctions/nanmax/znanmaxcola.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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"
-#include "doubleComplex.h"
-
-void znanmaxcola(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]= znanmaxa( inter, col);
-
- }
-
-
-}
diff --git a/src/c/elementaryFunctions/nanmax/znanmaxrowa.c b/src/c/elementaryFunctions/nanmax/znanmaxrowa.c
deleted file mode 100644
index e035e778..00000000
--- a/src/c/elementaryFunctions/nanmax/znanmaxrowa.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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"
-#include "doubleComplex.h"
-
-void znanmaxrowa(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]= znanmaxa( inter, row);
-
- }
-
-
-}