diff options
author | torset | 2009-02-17 15:34:23 +0000 |
---|---|---|
committer | torset | 2009-02-17 15:34:23 +0000 |
commit | 853aa42539de40bdcf220c0066b89e6da5d38936 (patch) | |
tree | 308b586a036e6bb9f59a399183776868d15ec4a4 /src | |
parent | ec715fdbd253ac7c172d4f9e2305731e1e71908c (diff) | |
download | scilab2c-853aa42539de40bdcf220c0066b89e6da5d38936.tar.gz scilab2c-853aa42539de40bdcf220c0066b89e6da5d38936.tar.bz2 scilab2c-853aa42539de40bdcf220c0066b89e6da5d38936.zip |
add max function for arrays
Diffstat (limited to 'src')
-rw-r--r-- | src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci | 22 | ||||
-rw-r--r-- | src/Scilab2C/Scilab2C/CFiles/sci2cincludes/sci2clib.h | 39 | ||||
l--------- | src/Scilab2C/Scilab2C/CFiles/sci2cinterfaces/int_max.h | 1 | ||||
l--------- | src/Scilab2C/Scilab2C/CFiles/sci2cinterfaces/int_min.h | 1 | ||||
-rw-r--r-- | src/auxiliaryFunctions/includes/max.h | 4 | ||||
-rw-r--r-- | src/auxiliaryFunctions/includes/min.h | 3 | ||||
-rw-r--r-- | src/auxiliaryFunctions/interfaces/int_max.h | 26 | ||||
-rw-r--r-- | src/auxiliaryFunctions/interfaces/int_min.h | 26 |
8 files changed, 87 insertions, 35 deletions
diff --git a/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci b/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci index 3f3822ea..7379e218 100644 --- a/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci +++ b/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci @@ -2,28 +2,20 @@ function mainfunction()
-//test OpApex(transpose&conj) & OpDotApex(transpose) +//test max && min //reals -disp(3') +disp(max(3,-2)) -disp(3.') +disp(min(3,-2)) -a=[4 2 4 8;3 4 5 1;1 4 5 6; 7 4 5 3] +a=[4 -2 4 8;-3 4 5 -1;1 -4 5 6; -7 -4 5 3] +b=[2 7 1 4; 3 -5 4 8; 2 -6 9 7; 1 -2 3 -4] -disp(a') -disp(a.') +disp(max(a,b)) -//complexes +disp(min(a,b)) -disp((3+%i)') - -disp((3+%i).') - -b=2.5*a+a*%i; - -disp(b') -disp(b.') endfunction diff --git a/src/Scilab2C/Scilab2C/CFiles/sci2cincludes/sci2clib.h b/src/Scilab2C/Scilab2C/CFiles/sci2cincludes/sci2clib.h index 72881952..a5151ea7 100644 --- a/src/Scilab2C/Scilab2C/CFiles/sci2cincludes/sci2clib.h +++ b/src/Scilab2C/Scilab2C/CFiles/sci2cincludes/sci2clib.h @@ -6,14 +6,8 @@ #include "constant.h"
#include "notFound.h"
#include "doubleComplex.h"
-#include "min.h"
-#include "max.h"
#include "floatComplex.h"
#include "RealToComplex.h"
-#include "ones.h"
-#include "zeros.h"
-#include "OpApex.h"
-#include "OpColon.h"
#include "OpDotHat.h"
#include "OpEqual.h"
#include "OpIns.h"
@@ -26,12 +20,8 @@ #include "OpLogEq.h"
#include "OpLogOr.h"
#include "OpLogAnd.h"
-#include "ConvertPrecision.h"
-#include "abs.h"
-#include "int_abs.h"
-#include "log10.h"
-#include "int_log10.h"
-#include "pythag.h" +#include "ConvertPrecision.h" + /* LIB */ /* interfacing lapack */ @@ -41,16 +31,21 @@ /* AUXILIARY FUNCTIONS */ +/* interfacing abs */ +#include "abs.h" +#include "int_abs.h" +/* interfacing conj */ +#include "conj.h" +#include "int_conj.h" +/* interfacing disp */ +#include "disp.h" +#include "int_disp.h" /* interfacing find */ #include "find.h" #include "find2d.h" #include "int_find.h" -/* interfacing disp */ -#include "disp.h" -#include "int_disp.h" -/* interfacing conj */ -#include "conj.h" -#include "int_conj.h" +/* interfacing frexp */ +#include "frexp.h" /* interfacing isempty */ #include "isempty.h" #include "int_isempty.h" @@ -60,10 +55,14 @@ /* interfacing length */
#include "length.h"
#include "int_length.h" +/* interfacing max */
+#include "max.h"
+#include "int_max.h" +/* interfacing min */
+#include "min.h"
+#include "int_min.h" /* interfacing pythag */ #include "pythag.h" -/* interfacing frexp */ -#include "frexp.h" /* interfacing sign */ #include "sign.h" #include "int_sign.h" diff --git a/src/Scilab2C/Scilab2C/CFiles/sci2cinterfaces/int_max.h b/src/Scilab2C/Scilab2C/CFiles/sci2cinterfaces/int_max.h new file mode 120000 index 00000000..42598690 --- /dev/null +++ b/src/Scilab2C/Scilab2C/CFiles/sci2cinterfaces/int_max.h @@ -0,0 +1 @@ +../../../../auxiliaryFunctions/interfaces/int_max.h
\ No newline at end of file diff --git a/src/Scilab2C/Scilab2C/CFiles/sci2cinterfaces/int_min.h b/src/Scilab2C/Scilab2C/CFiles/sci2cinterfaces/int_min.h new file mode 120000 index 00000000..0ac089e9 --- /dev/null +++ b/src/Scilab2C/Scilab2C/CFiles/sci2cinterfaces/int_min.h @@ -0,0 +1 @@ +../../../../auxiliaryFunctions/interfaces/int_min.h
\ No newline at end of file diff --git a/src/auxiliaryFunctions/includes/max.h b/src/auxiliaryFunctions/includes/max.h index 30317114..c37bfea5 100644 --- a/src/auxiliaryFunctions/includes/max.h +++ b/src/auxiliaryFunctions/includes/max.h @@ -15,4 +15,8 @@ #define max(a,b) (a>=b?a:b) +#define maxa(a,size1,b,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=max(a[i],b[i]);\ + } + #endif /* !__MAX_H__ */ diff --git a/src/auxiliaryFunctions/includes/min.h b/src/auxiliaryFunctions/includes/min.h index 462bd671..70097d10 100644 --- a/src/auxiliaryFunctions/includes/min.h +++ b/src/auxiliaryFunctions/includes/min.h @@ -14,4 +14,7 @@ #define min(a,b) (a<=b?a:b) +#define mina(a,size1,b,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=min(a[i],b[i]);\ + } #endif /* !__MIN_H__ */ diff --git a/src/auxiliaryFunctions/interfaces/int_max.h b/src/auxiliaryFunctions/interfaces/int_max.h new file mode 100644 index 00000000..a3f0562d --- /dev/null +++ b/src/auxiliaryFunctions/interfaces/int_max.h @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_MAX_H__ +#define __INT_MAX_H__ + +#define s0s0maxs0(in1,in2) max(in1,in2) + +#define d0d0maxd0(in1,in2) max(in1,in2) + +#define s2s2maxs2(in,size,out) maxa(in1, size[0]*size[1], in2, size[0]*size[1], out) + +#define d2d2maxd2(in,size,out) maxa(in1, size[0]*size[1], in2, size[0]*size[1], out) + +#endif /* !__INT_MAX_H__ */ diff --git a/src/auxiliaryFunctions/interfaces/int_min.h b/src/auxiliaryFunctions/interfaces/int_min.h new file mode 100644 index 00000000..d7c59c0c --- /dev/null +++ b/src/auxiliaryFunctions/interfaces/int_min.h @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_MIN_H__ +#define __INT_MIN_H__ + +#define s0s0mins0(in1,in2) min(in1,in2) + +#define d0d0mind0(in1,in2) min(in1,in2) + +#define s2s2mins2(in,size,out) mina(in1, size[0]*size[1], in2, size[0]*size[1], out) + +#define d2d2mind2(in,size,out) mina(in1, size[0]*size[1], in2, size[0]*size[1], out) + +#endif /* !__INT_MIN_H__ */ |