diff options
author | jofret | 2009-06-05 15:31:48 +0000 |
---|---|---|
committer | jofret | 2009-06-05 15:31:48 +0000 |
commit | 74ee91efdd1d12cb6e224ecc87f0cc51a51bcbc1 (patch) | |
tree | 484736de55d5ce87a2503cb7024c1835f8073766 | |
parent | 462563271edd528e1785ed30beff1683f1859ac2 (diff) | |
download | scilab2c-74ee91efdd1d12cb6e224ecc87f0cc51a51bcbc1.tar.gz scilab2c-74ee91efdd1d12cb6e224ecc87f0cc51a51bcbc1.tar.bz2 scilab2c-74ee91efdd1d12cb6e224ecc87f0cc51a51bcbc1.zip |
Enable order comparison
-rw-r--r-- | includes/sci2clib.h | 4 | ||||
-rw-r--r-- | macros/CFiles/sci2cincludes/OpLogGt.h | 37 | ||||
-rw-r--r-- | macros/findDeps/getAllInterfaces.sci | 4 | ||||
-rw-r--r-- | src/c/operations/interfaces/int_OpLogGe.h | 50 | ||||
-rw-r--r-- | src/c/operations/interfaces/int_OpLogGt.h | 50 | ||||
-rw-r--r-- | src/c/operations/interfaces/int_OpLogLe.h | 50 | ||||
-rw-r--r-- | src/c/operations/interfaces/int_OpLogLt.h | 50 | ||||
-rw-r--r-- | tests/unit_tests/test_double_OpLogEq.sci | 25 | ||||
-rw-r--r-- | tests/unit_tests/test_double_OpLogGe.sci | 11 | ||||
-rw-r--r-- | tests/unit_tests/test_double_OpLogGt.sci | 11 | ||||
-rw-r--r-- | tests/unit_tests/test_double_OpLogLt.sci | 10 | ||||
-rw-r--r-- | tests/unit_tests/test_double_OpLogNe.sci | 25 |
12 files changed, 290 insertions, 37 deletions
diff --git a/includes/sci2clib.h b/includes/sci2clib.h index b6ac037a..5ecb54fd 100644 --- a/includes/sci2clib.h +++ b/includes/sci2clib.h @@ -185,6 +185,10 @@ /* interfacing comparison */ #include "int_OpLogEq.h" #include "int_OpLogNe.h" +#include "int_OpLogGt.h" +#include "int_OpLogGe.h" +#include "int_OpLogLt.h" +#include "int_OpLogLe.h" /* MATRIX OPERATIONS */ diff --git a/macros/CFiles/sci2cincludes/OpLogGt.h b/macros/CFiles/sci2cincludes/OpLogGt.h deleted file mode 100644 index 88715092..00000000 --- a/macros/CFiles/sci2cincludes/OpLogGt.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -** -*- C -*- -** -** -** Made by Raffaele.Nutricato@tiscali.it -** -** Started on Tue Dec 5 15:49:18 2006 jofret -** Last update Mon Oct 22 10:01:54 2007 bruno -** -** Copyright INRIA 2006 -*/ - -/* - Update 23/02/09 by Arnaud Torset : Add matrix comparaison, remove include(floatComplex and doubleComplex) -*/ - -#ifndef __OPLOGGT_H__ -#define __OPLOGGT_H__ - - -#define s0s0OpLogGts0(in1,in2) \
- (float) (in1 > in2) -void s2s0OpLogGts2(float* in1, int* in1Size, float in2, float* out); - -#define d0d0OpLogGtd0(in1,in2) \
- (double) (in1 > in2) -void d2d0OpLogGtd2(double* in1, int* in1Size, double in2, double* out); - -/* we must have size1=size2 */ - -#define s2s2OpLogGts2(in1,size1,in2,size2,out) {int i;\ - for (i=0;i<size1[0]*size2[1]) out[i] = s0s0OpLogGts0(in1[i],in2[i]);\ - } -#define d2d2OpLogGtd2(in1,size1,in2,size2,out) {int i;\ - for (i=0;i<size1[0]*size2[1]) out[i] = d0d0OpLogGtd0(in1[i],in2[i]);\ - } -#endif /* !__OPLOGGT_H__ */ diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index 96d9a960..be0cd443 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -83,6 +83,10 @@ function allInterfaces = getAllInterfaces() "src/c/operations/interfaces/int_OpEqual.h" "src/c/operations/interfaces/int_OpLogEq.h" "src/c/operations/interfaces/int_OpLogNe.h" + "src/c/operations/interfaces/int_OpLogGt.h" + "src/c/operations/interfaces/int_OpLogGe.h" + "src/c/operations/interfaces/int_OpLogLt.h" + "src/c/operations/interfaces/int_OpLogLe.h" "src/c/operations/interfaces/int_OpDotStar.h" "src/c/operations/interfaces/int_OpDotSlash.h" "src/c/operations/interfaces/int_OpBackSlash.h" diff --git a/src/c/operations/interfaces/int_OpLogGe.h b/src/c/operations/interfaces/int_OpLogGe.h new file mode 100644 index 00000000..0ce1ad81 --- /dev/null +++ b/src/c/operations/interfaces/int_OpLogGe.h @@ -0,0 +1,50 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2007 - 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 + * + */ + +/* + Update 23/02/09 by Arnaud Torset : Add matrix comparaison, remove include(floatComplex and doubleComplex) +*/ + +#ifndef __OPLOGGE_H__ +#define __OPLOGGE_H__ + + +#define s0s0OpLogGes0(in1,in2) (float) (in1 >= in2) +#define d0d0OpLogGed0(in1,in2) (double) (in1 >= in2) + + +#define s2s0OpLogGes2(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogGes0(in1[i],in2);\ + } + +#define s0s2OpLogGes2(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = s0s0OpLogGes0(in1,in2[i]);\ + } + +/* we must have size1=size2 */ +#define s2s2OpLogGes2(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogGes0(in1[i],in2[i]);\ + } + +#define d2d0OpLogGed2(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogGed0(in1[i],in2);\ + } + +#define d0d2OpLogGed2(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = d0d0OpLogGed0(in1,in2[i]);\ + } + +/* we must have size1=size2 */ +#define d2d2OpLogGed2(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogGed0(in1[i],in2[i]);\ + } +#endif /* !__OPLOGGE_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogGt.h b/src/c/operations/interfaces/int_OpLogGt.h new file mode 100644 index 00000000..161b654f --- /dev/null +++ b/src/c/operations/interfaces/int_OpLogGt.h @@ -0,0 +1,50 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2007 - 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 + * + */ + +/* + Update 23/02/09 by Arnaud Torset : Add matrix comparaison, remove include(floatComplex and doubleComplex) +*/ + +#ifndef __OPLOGGT_H__ +#define __OPLOGGT_H__ + + +#define s0s0OpLogGts0(in1,in2) (float) (in1 > in2) +#define d0d0OpLogGtd0(in1,in2) (double) (in1 > in2) + + +#define s2s0OpLogGts2(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogGts0(in1[i],in2);\ + } + +#define s0s2OpLogGts2(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = s0s0OpLogGts0(in1,in2[i]);\ + } + +/* we must have size1=size2 */ +#define s2s2OpLogGts2(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogGts0(in1[i],in2[i]);\ + } + +#define d2d0OpLogGtd2(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogGtd0(in1[i],in2);\ + } + +#define d0d2OpLogGtd2(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = d0d0OpLogGtd0(in1,in2[i]);\ + } + +/* we must have size1=size2 */ +#define d2d2OpLogGtd2(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogGtd0(in1[i],in2[i]);\ + } +#endif /* !__OPLOGGT_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogLe.h b/src/c/operations/interfaces/int_OpLogLe.h new file mode 100644 index 00000000..ebb09c7b --- /dev/null +++ b/src/c/operations/interfaces/int_OpLogLe.h @@ -0,0 +1,50 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2007 - 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 + * + */ + +/* + Update 23/02/09 by Arnaud Torset : Add matrix comparaison, remove include(floatComplex and doubleComplex) +*/ + +#ifndef __OPLOGLE_H__ +#define __OPLOGLE_H__ + + +#define s0s0OpLogLes0(in1,in2) (float) (in1 <= in2) +#define d0d0OpLogLed0(in1,in2) (double) (in1 <= in2) + + +#define s2s0OpLogLes2(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogLes0(in1[i],in2);\ + } + +#define s0s2OpLogLes2(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = s0s0OpLogLes0(in1,in2[i]);\ + } + +/* we must have size1=size2 */ +#define s2s2OpLogLes2(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogLes0(in1[i],in2[i]);\ + } + +#define d2d0OpLogLed2(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogLed0(in1[i],in2);\ + } + +#define d0d2OpLogLed2(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = d0d0OpLogLed0(in1,in2[i]);\ + } + +/* we must have size1=size2 */ +#define d2d2OpLogLed2(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogLed0(in1[i],in2[i]);\ + } +#endif /* !__OPLOGLE_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogLt.h b/src/c/operations/interfaces/int_OpLogLt.h new file mode 100644 index 00000000..2c5d8639 --- /dev/null +++ b/src/c/operations/interfaces/int_OpLogLt.h @@ -0,0 +1,50 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2007 - 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 + * + */ + +/* + Update 23/02/09 by Arnaud Torset : Add matrix comparaison, remove include(floatComplex and doubleComplex) +*/ + +#ifndef __OPLOGLT_H__ +#define __OPLOGLT_H__ + + +#define s0s0OpLogLts0(in1,in2) (float) (in1 < in2) +#define d0d0OpLogLtd0(in1,in2) (double) (in1 < in2) + + +#define s2s0OpLogLts2(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogLts0(in1[i],in2);\ + } + +#define s0s2OpLogLts2(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = s0s0OpLogLts0(in1,in2[i]);\ + } + +/* we must have size1=size2 */ +#define s2s2OpLogLts2(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogLts0(in1[i],in2[i]);\ + } + +#define d2d0OpLogLtd2(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogLtd0(in1[i],in2);\ + } + +#define d0d2OpLogLtd2(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = d0d0OpLogLtd0(in1,in2[i]);\ + } + +/* we must have size1=size2 */ +#define d2d2OpLogLtd2(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogLtd0(in1[i],in2[i]);\ + } +#endif /* !__OPLOGLT_H__ */ diff --git a/tests/unit_tests/test_double_OpLogEq.sci b/tests/unit_tests/test_double_OpLogEq.sci new file mode 100644 index 00000000..e0e843b6 --- /dev/null +++ b/tests/unit_tests/test_double_OpLogEq.sci @@ -0,0 +1,25 @@ +function test_double_OpLogEq() + a = 1; + b = 2 + %i; + c = [1 2 3] + d = %i * [1 2 3 4 5 6] + disp(a == a); // d0d0OpLogEqd0 + disp(a == b); // d0z0OpLogEqd0 + disp(a == c); // d0d2OpLogEqd2 + disp(a == d); // d0z2OpLogEqd2 + + disp(b == a); // z0d0OpLogEqd0 + disp(b == b); // z0z0OpLogEqd0 + disp(b == c); // z0d2OpLogEqd2 + disp(b == d); // z0z2OpLogEqd2 + + disp(c == a); // d2d0OpLogEqd0 + disp(c == b); // d2z0OpLogEqd0 + disp(c == c); // d2d2OpLogEqd2 + disp(c == d); // d2z2OpLogEqd2 + + disp(d == a); // z2d0OpLogEqd0 + disp(d == b); // z2z0OpLogEqd0 + disp(d == c); // z2d2OpLogEqd2 + disp(d == d); // z2z2OpLogEqd2 +endfunction diff --git a/tests/unit_tests/test_double_OpLogGe.sci b/tests/unit_tests/test_double_OpLogGe.sci new file mode 100644 index 00000000..9aca3e75 --- /dev/null +++ b/tests/unit_tests/test_double_OpLogGe.sci @@ -0,0 +1,11 @@ +function test_double_OpLogGe() + a = 1; + c = [1 2 3] + + disp(a >= a); // d0d0OpLogEqd0 + disp(a >= c); // d0d2OpLogEqd2 + + disp(c >= a); // d2d0OpLogEqd0 + disp(c >= c); // d2d2OpLogEqd2 + +endfunction diff --git a/tests/unit_tests/test_double_OpLogGt.sci b/tests/unit_tests/test_double_OpLogGt.sci new file mode 100644 index 00000000..70a1ef39 --- /dev/null +++ b/tests/unit_tests/test_double_OpLogGt.sci @@ -0,0 +1,11 @@ +function test_double_OpLogGt() + a = 1; + c = [1 2 3] + + disp(a > a); // d0d0OpLogEqd0 + disp(a > c); // d0d2OpLogEqd2 + + disp(c > a); // d2d0OpLogEqd0 + disp(c > c); // d2d2OpLogEqd2 + +endfunction diff --git a/tests/unit_tests/test_double_OpLogLt.sci b/tests/unit_tests/test_double_OpLogLt.sci new file mode 100644 index 00000000..ec06fcc2 --- /dev/null +++ b/tests/unit_tests/test_double_OpLogLt.sci @@ -0,0 +1,10 @@ +function test_double_OpLogLt() + a = 1; + c = [1 2 3] + + disp(a < a); // d0d0OpLogEqd0 + disp(a < c); // d0d2OpLogEqd2 + + disp(c < a); // d2d0OpLogEqd0 + disp(c < c); // d2d2OpLogEqd2 +endfunction diff --git a/tests/unit_tests/test_double_OpLogNe.sci b/tests/unit_tests/test_double_OpLogNe.sci new file mode 100644 index 00000000..64d582d8 --- /dev/null +++ b/tests/unit_tests/test_double_OpLogNe.sci @@ -0,0 +1,25 @@ +function test_double_OpLogNe() + a = 1; + b = 2 + %i; + c = [1 2 3] + d = %i * [1 2 3 4 5 6] + disp(a <> a); // d0d0OpLogEqd0 + disp(a <> b); // d0z0OpLogEqd0 + disp(a <> c); // d0d2OpLogEqd2 + disp(a <> d); // d0z2OpLogEqd2 + + disp(b <> a); // z0d0OpLogEqd0 + disp(b <> b); // z0z0OpLogEqd0 + disp(b <> c); // z0d2OpLogEqd2 + disp(b <> d); // z0z2OpLogEqd2 + + disp(c <> a); // d2d0OpLogEqd0 + disp(c <> b); // d2z0OpLogEqd0 + disp(c <> c); // d2d2OpLogEqd2 + disp(c <> d); // d2z2OpLogEqd2 + + disp(d <> a); // z2d0OpLogEqd0 + disp(d <> b); // z2z0OpLogEqd0 + disp(d <> c); // z2d2OpLogEqd2 + disp(d <> d); // z2z2OpLogEqd2 +endfunction |