diff options
author | siddhu8990 | 2015-09-07 21:27:00 +0530 |
---|---|---|
committer | siddhu8990 | 2015-09-07 21:27:00 +0530 |
commit | 0bdaec9811b3e463514393aa1d3da6c3a96891a1 (patch) | |
tree | 2a012c5d922662809ce71930b53781106e2d57ea /src | |
parent | 222a3e39441ad408dacdc39d46d687dee5a6bf3c (diff) | |
download | Scilab2C_fossee_old-0bdaec9811b3e463514393aa1d3da6c3a96891a1.tar.gz Scilab2C_fossee_old-0bdaec9811b3e463514393aa1d3da6c3a96891a1.tar.bz2 Scilab2C_fossee_old-0bdaec9811b3e463514393aa1d3da6c3a96891a1.zip |
Changes made for arduino support
Diffstat (limited to 'src')
83 files changed, 1895 insertions, 60 deletions
diff --git a/src/c/auxiliaryFunctions/abs/i16absa.c b/src/c/auxiliaryFunctions/abs/i16absa.c new file mode 100644 index 0000000..ad37cee --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i16absa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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 + * + */ + +#include "abs.h" + +void i16absa(int16 *in, int size, int16* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i16abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/i16abss.c b/src/c/auxiliaryFunctions/abs/i16abss.c new file mode 100644 index 0000000..591ab8d --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i16abss.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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 + * + */ + +#include "abs.h" + +int16 i16abss(int16 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/i8absa.c b/src/c/auxiliaryFunctions/abs/i8absa.c new file mode 100644 index 0000000..2f015f2 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i8absa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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 + * + */ + +#include "abs.h" + +void i8absa(int8 *in, int size, int8* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i8abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/i8abss.c b/src/c/auxiliaryFunctions/abs/i8abss.c new file mode 100644 index 0000000..7c3d707 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i8abss.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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 + * + */ + +#include "abs.h" + +int8 i8abss(int8 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/u16absa.c b/src/c/auxiliaryFunctions/abs/u16absa.c new file mode 100644 index 0000000..5bc1d14 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u16absa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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 + * + */ + +#include "abs.h" + +void u16absa(uint16 *in, int size, uint16* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u16abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/u16abss.c b/src/c/auxiliaryFunctions/abs/u16abss.c new file mode 100644 index 0000000..056ca80 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u16abss.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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 + * + */ + +#include "abs.h" + +uint16 u16abss(uint16 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/u8absa.c b/src/c/auxiliaryFunctions/abs/u8absa.c new file mode 100644 index 0000000..cc649c8 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u8absa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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 + * + */ + +#include "abs.h" + +void u8absa(uint8 *in, int size, uint8* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u8abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/u8abss.c b/src/c/auxiliaryFunctions/abs/u8abss.c new file mode 100644 index 0000000..45ea9a5 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u8abss.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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 + * + */ + +#include "abs.h" + +uint8 u8abss(uint8 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/includes/abs.h b/src/c/auxiliaryFunctions/includes/abs.h index 00565e3..cd02290 100644 --- a/src/c/auxiliaryFunctions/includes/abs.h +++ b/src/c/auxiliaryFunctions/includes/abs.h @@ -17,6 +17,7 @@ #include "floatComplex.h" #include "doubleComplex.h" #include "sqrt.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -55,6 +56,38 @@ EXTERN_AUXFUNCT float cabss(floatComplex in); EXTERN_AUXFUNCT double zabss(doubleComplex in); /** + ** \brief Uint8 Absolute Value function + ** Determine the absolute value of in. + ** \param in : the uint8 we must determine abs. + ** \return -in or in depending on the sign of in. + **/ +EXTERN_AUXFUNCT uint8 u8abss(uint8 in); + +/** + ** \brief Int8 Absolute Value function + ** Determine the absolute value of in. + ** \param in : the int8 we must determine abs. + ** \return -in or in depending on the sign of in. + **/ +EXTERN_AUXFUNCT int8 i8abss(int8 in); + +/** + ** \brief Uint16 Absolute Value function + ** Determine the absolute value of in. + ** \param in : the uint16 we must determine abs. + ** \return -in or in depending on the sign of in. + **/ +EXTERN_AUXFUNCT uint16 u16abss(uint16 in); + +/** + ** \brief Int16 Absolute Value function + ** Determine the absolute value of in. + ** \param in : the int16 we must determine abs. + ** \return -in or in depending on the sign of in. + **/ +EXTERN_AUXFUNCT int16 i16abss(int16 in); + +/** ** \brief Float Array Absolute Value function ** Determine the absolute value of in elements. ** \param in : the float array we must determine abs. @@ -86,6 +119,40 @@ EXTERN_AUXFUNCT void cabsa(floatComplex *in, int size, float* out); **/ EXTERN_AUXFUNCT void zabsa(doubleComplex *in, int size, double* out); + +/** + ** \brief Uint8 Array Absolute Value function + ** Determine the absolute value of in elements. + ** \param in : the uint8 array we must determine abs. + ** \param out : the uint8 array result. + **/ +EXTERN_AUXFUNCT void u8absa(uint8 *in, int size, uint8* out); + +/** + ** \brief Int8 Array Absolute Value function + ** Determine the absolute value of in elements. + ** \param in : the int8 array we must determine abs. + ** \param out : the int8 array result. + **/ +EXTERN_AUXFUNCT void i8absa(int8 *in, int size, int8* out); + +/** + ** \brief Uint16 Array Absolute Value function + ** Determine the absolute value of in elements. + ** \param in : the uint16 array we must determine abs. + ** \param out : the uint16 array result. + **/ +EXTERN_AUXFUNCT void u16absa(uint16 *in, int size, uint16* out); + +/** + ** \brief Int16 Array Absolute Value function + ** Determine the absolute value of in elements. + ** \param in : the int16 array we must determine abs. + ** \param out : the int16 array result. + **/ +EXTERN_AUXFUNCT void i16absa(int16 *in, int size, int16* out); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/auxiliaryFunctions/interfaces/int_abs.h b/src/c/auxiliaryFunctions/interfaces/int_abs.h index 4c353fe..70a428c 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_abs.h +++ b/src/c/auxiliaryFunctions/interfaces/int_abs.h @@ -23,6 +23,14 @@ #define z0absd0(in) zabss(in) +#define u80absu80(in) u8abss(in) + +#define i80absi80(in) i8abss(in) + +#define u160absu160(in) u16abss(in) + +#define i160absi160(in) i16abss(in) + #define s2abss2(in,size,out) sabsa(in, size[0]*size[1], out) #define d2absd2(in,size,out) dabsa(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2absd2(in,size,out) zabsa(in, size[0]*size[1], out) +#define u82absu82(in,size,out) u8absa(in, size[0]*size[1], out) + +#define i82absi82(in,size,out) i8absa(in, size[0]*size[1], out) + +#define u162absu162(in,size,out) u16absa(in, size[0]*size[1], out) + +#define i162absi162(in,size,out) i16absa(in, size[0]*size[1], out) + #endif /* !__INT_ABS_H__ */ diff --git a/src/c/auxiliaryFunctions/interfaces/int_conj.h b/src/c/auxiliaryFunctions/interfaces/int_conj.h index f54de24..fec555b 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_conj.h +++ b/src/c/auxiliaryFunctions/interfaces/int_conj.h @@ -25,6 +25,14 @@ #define z0conjz0(in) zconjs(in) +#define u80conju80(in) in + +#define i80conji80(in) in + +#define u160conju160(in) in + +#define i160conji160(in) in + #define s2conjs2(in,size,out) copy(in,size,out) #define d2conjd2(in,size,out) copy(in,size,out) @@ -33,4 +41,12 @@ #define z2conjz2(in,size,out) zconja(in, size[0]*size[1], out) +#define u82conju82(in,size,out) copy(in,size,out) + +#define i82conji82(in,size,out) copy(in,size,out) + +#define u162conju162(in,size,out) copy(in,size,out) + +#define i162conji162(in,size,out) copy(in,size,out) + #endif /* !__INT_CONJ_H__ */ diff --git a/src/c/elementaryFunctions/ceil/i16ceila.c b/src/c/elementaryFunctions/ceil/i16ceila.c new file mode 100644 index 0000000..a960fa8 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i16ceila.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "ceil.h" + +void i16ceila(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/i16ceils.c b/src/c/elementaryFunctions/ceil/i16ceils.c new file mode 100644 index 0000000..2dee983 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i16ceils.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "ceil.h" + +int16 i16ceils(int16 x) { + return (int16)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/i8ceila.c b/src/c/elementaryFunctions/ceil/i8ceila.c new file mode 100644 index 0000000..3308174 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i8ceila.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "ceil.h" + +void i8ceila(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/i8ceils.c b/src/c/elementaryFunctions/ceil/i8ceils.c new file mode 100644 index 0000000..e87bd61 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i8ceils.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "ceil.h" + +int8 i8ceils(int8 x) { + return (int8)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/u16ceila.c b/src/c/elementaryFunctions/ceil/u16ceila.c new file mode 100644 index 0000000..c7e83df --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u16ceila.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "ceil.h" + +void u16ceila(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/u16ceils.c b/src/c/elementaryFunctions/ceil/u16ceils.c new file mode 100644 index 0000000..4632eec --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u16ceils.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "ceil.h" + +uint16 u16ceils(uint16 x) { + return (uint16)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/u8ceila.c b/src/c/elementaryFunctions/ceil/u8ceila.c new file mode 100644 index 0000000..3bb4ca9 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u8ceila.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "ceil.h" + +void u8ceila(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/u8ceils.c b/src/c/elementaryFunctions/ceil/u8ceils.c new file mode 100644 index 0000000..7f28bba --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u8ceils.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "ceil.h" + +uint8 u8ceils(uint8 x) { + return (uint8)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/cosh/i16cosha.c b/src/c/elementaryFunctions/cosh/i16cosha.c index 8515bc7..eb2e9f9 100644 --- a/src/c/elementaryFunctions/cosh/i16cosha.c +++ b/src/c/elementaryFunctions/cosh/i16cosha.c @@ -1,6 +1,6 @@ /* * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * Copyright (C) 2006-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 @@ -10,17 +10,11 @@ * */ -/* -// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) -// = 0.5 ( y + 1/y ) with y = exp(|z|) -*/ - -#include <math.h> #include "cosh.h" -#include "exp.h" -#include "abs.h" -float i16coshs(int16 x) { - float y = i16exps(i16abss(x)); - return (0.5f * (y + 1.0f / y)); +void i16cosha(int16* x, int size, int16* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i16coshs(x[i]); + } } diff --git a/src/c/elementaryFunctions/cosh/i8cosha.c b/src/c/elementaryFunctions/cosh/i8cosha.c index b30c14e..beed9b3 100644 --- a/src/c/elementaryFunctions/cosh/i8cosha.c +++ b/src/c/elementaryFunctions/cosh/i8cosha.c @@ -1,6 +1,6 @@ /* * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * Copyright (C) 2006-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 @@ -10,17 +10,11 @@ * */ -/* -// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) -// = 0.5 ( y + 1/y ) with y = exp(|z|) -*/ - -#include <math.h> #include "cosh.h" -#include "exp.h" -#include "abs.h" -float i8coshs(int8 x) { - float y = i8exps(i8abss(x)); - return (0.5f * (y + 1.0f / y)); +void i8cosha(int8* x, int size, int8* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i8coshs(x[i]); + } } diff --git a/src/c/elementaryFunctions/cosh/u16cosha.c b/src/c/elementaryFunctions/cosh/u16cosha.c index 775f710..e0c4183 100644 --- a/src/c/elementaryFunctions/cosh/u16cosha.c +++ b/src/c/elementaryFunctions/cosh/u16cosha.c @@ -1,6 +1,6 @@ /* * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * Copyright (C) 2006-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 @@ -10,17 +10,11 @@ * */ -/* -// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) -// = 0.5 ( y + 1/y ) with y = exp(|z|) -*/ - -#include <math.h> #include "cosh.h" -#include "exp.h" -#include "abs.h" -float u16coshs(uint16 x) { - float y = u16exps(u16abss(x)); - return (0.5f * (y + 1.0f / y)); +void u16cosha(uint16* x, int size, uint16* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u16coshs(x[i]); + } } diff --git a/src/c/elementaryFunctions/cosh/u8cosha.c b/src/c/elementaryFunctions/cosh/u8cosha.c index b6d614f..9584b3e 100644 --- a/src/c/elementaryFunctions/cosh/u8cosha.c +++ b/src/c/elementaryFunctions/cosh/u8cosha.c @@ -1,6 +1,6 @@ /* * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * Copyright (C) 2006-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 @@ -10,17 +10,11 @@ * */ -/* -// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) -// = 0.5 ( y + 1/y ) with y = exp(|z|) -*/ - -#include <math.h> #include "cosh.h" -#include "exp.h" -#include "abs.h" -float u8coshs(uint8 x) { - float y = u8exps(u8abss(x)); - return (0.5f * (y + 1.0f / y)); +void u8cosha(uint8* x, int size, uint8* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u8coshs(x[i]); + } } diff --git a/src/c/elementaryFunctions/fix/i16fixa.c b/src/c/elementaryFunctions/fix/i16fixa.c new file mode 100644 index 0000000..2ccb933 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i16fixa.c @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +void i16fixa(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/i16fixs.c b/src/c/elementaryFunctions/fix/i16fixs.c new file mode 100644 index 0000000..5a13ca0 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i16fixs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "fix.h" + +int16 i16fixs(int16 x) { + if (x>=0) return i16floors(x); + else return i16ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/i8fixa.c b/src/c/elementaryFunctions/fix/i8fixa.c new file mode 100644 index 0000000..4e913a3 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i8fixa.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "fix.h" + +void i8fixa(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/i8fixs.c b/src/c/elementaryFunctions/fix/i8fixs.c new file mode 100644 index 0000000..ae331ff --- /dev/null +++ b/src/c/elementaryFunctions/fix/i8fixs.c @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +int8 i8fixs(int8 x) { + if (x>=0) return i8floors(x); + else return i8ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/u16fixa.c b/src/c/elementaryFunctions/fix/u16fixa.c new file mode 100644 index 0000000..5798300 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u16fixa.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "fix.h" + +void u16fixa(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/u16fixs.c b/src/c/elementaryFunctions/fix/u16fixs.c new file mode 100644 index 0000000..cf17847 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u16fixs.c @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +uint16 u16fixs(uint16 x) { + if (x>=0) return u16floors(x); + else return u16ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/u8fixa.c b/src/c/elementaryFunctions/fix/u8fixa.c new file mode 100644 index 0000000..2a3bd3b --- /dev/null +++ b/src/c/elementaryFunctions/fix/u8fixa.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "fix.h" + +void u8fixa(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/u8fixs.c b/src/c/elementaryFunctions/fix/u8fixs.c new file mode 100644 index 0000000..563bfe9 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u8fixs.c @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +uint8 u8fixs(uint8 x) { + if (x>=0) return u8floors(x); + else return u8ceils(x); +} diff --git a/src/c/elementaryFunctions/floor/i16floora.c b/src/c/elementaryFunctions/floor/i16floora.c new file mode 100644 index 0000000..69140b0 --- /dev/null +++ b/src/c/elementaryFunctions/floor/i16floora.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "floor.h" + +void i16floora(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/i16floors.c b/src/c/elementaryFunctions/floor/i16floors.c new file mode 100644 index 0000000..428a745 --- /dev/null +++ b/src/c/elementaryFunctions/floor/i16floors.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "floor.h" + +int16 i16floors(int16 x) { + return (int16)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/i8floora.c b/src/c/elementaryFunctions/floor/i8floora.c new file mode 100644 index 0000000..0554f1e --- /dev/null +++ b/src/c/elementaryFunctions/floor/i8floora.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "floor.h" + +void i8floora(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/i8floors.c b/src/c/elementaryFunctions/floor/i8floors.c new file mode 100644 index 0000000..e78dfa1 --- /dev/null +++ b/src/c/elementaryFunctions/floor/i8floors.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "floor.h" + +int8 i8floors(int8 x) { + return (int8)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/u16floora.c b/src/c/elementaryFunctions/floor/u16floora.c new file mode 100644 index 0000000..56e35ca --- /dev/null +++ b/src/c/elementaryFunctions/floor/u16floora.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "floor.h" + +void u16floora(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/u16floors.c b/src/c/elementaryFunctions/floor/u16floors.c new file mode 100644 index 0000000..65455c1 --- /dev/null +++ b/src/c/elementaryFunctions/floor/u16floors.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "floor.h" + +uint16 u16floors(uint16 x) { + return (uint16)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/u8floora.c b/src/c/elementaryFunctions/floor/u8floora.c new file mode 100644 index 0000000..ace7ff7 --- /dev/null +++ b/src/c/elementaryFunctions/floor/u8floora.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "floor.h" + +void u8floora(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/u8floors.c b/src/c/elementaryFunctions/floor/u8floors.c new file mode 100644 index 0000000..efb2e8c --- /dev/null +++ b/src/c/elementaryFunctions/floor/u8floors.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + +#include <math.h> +#include "floor.h" + +uint8 u8floors(uint8 x) { + return (uint8)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/includes/ceil.h b/src/c/elementaryFunctions/includes/ceil.h index 960b8b3..57df72d 100644 --- a/src/c/elementaryFunctions/includes/ceil.h +++ b/src/c/elementaryFunctions/includes/ceil.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus @@ -33,6 +34,14 @@ EXTERN_ELEMFUNCT floatComplex cceils(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zceils(doubleComplex in); +EXTERN_ELEMFUNCT uint8 u8ceils(uint8 in); + +EXTERN_ELEMFUNCT int8 i8ceils(int8 in); + +EXTERN_ELEMFUNCT uint16 u16ceils(uint16 in); + +EXTERN_ELEMFUNCT int16 i16ceils(int16 in); + EXTERN_ELEMFUNCT void sceila(float* in, int size, float* out); EXTERN_ELEMFUNCT void dceila(double* in, int size, double* out); @@ -41,6 +50,14 @@ EXTERN_ELEMFUNCT void cceila(floatComplex* in, int size, floatComplex* out); EXTERN_ELEMFUNCT void zceila(doubleComplex* in, int size, doubleComplex* out); +EXTERN_ELEMFUNCT void u8ceila(uint8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8ceila(int8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16ceila(uint16* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16ceila(int16* in, int size, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/cosh.h b/src/c/elementaryFunctions/includes/cosh.h index e084e42..5c7c8b7 100644 --- a/src/c/elementaryFunctions/includes/cosh.h +++ b/src/c/elementaryFunctions/includes/cosh.h @@ -112,7 +112,7 @@ EXTERN_ELEMFUNCT void zcosha(doubleComplex* in, int size, doubleComplex* out); ** \param out : output array value. ** \param size : the size of in and out arrays. */ -EXTERN_ELEMFUNCT void u8cosha(uint8* in, int size, float* out); +EXTERN_ELEMFUNCT void u8cosha(uint8* in, int size, uint8* out); /* ** \brief Int8 Matrix Cosine function @@ -120,7 +120,7 @@ EXTERN_ELEMFUNCT void u8cosha(uint8* in, int size, float* out); ** \param out : output array value. ** \param size : the size of in and out arrays. */ -EXTERN_ELEMFUNCT void i8cosha(int8* in, int size, float* out); +EXTERN_ELEMFUNCT void i8cosha(int8* in, int size, int8* out); /* ** \brief Uint16 Matrix Cosine function @@ -128,7 +128,7 @@ EXTERN_ELEMFUNCT void i8cosha(int8* in, int size, float* out); ** \param out : output array value. ** \param size : the size of in and out arrays. */ -EXTERN_ELEMFUNCT void u16cosha(uint16* in, int size, float* out); +EXTERN_ELEMFUNCT void u16cosha(uint16* in, int size, uint16* out); /* ** \brief Int16 Matrix Cosine function @@ -136,7 +136,7 @@ EXTERN_ELEMFUNCT void u16cosha(uint16* in, int size, float* out); ** \param out : output array value. ** \param size : the size of in and out arrays. */ -EXTERN_ELEMFUNCT void i16cosha(int16* in, int size, float* out); +EXTERN_ELEMFUNCT void i16cosha(int16* in, int size, int16* out); #ifdef __cplusplus diff --git a/src/c/elementaryFunctions/includes/fix.h b/src/c/elementaryFunctions/includes/fix.h index 504a63c..d3e7f88 100644 --- a/src/c/elementaryFunctions/includes/fix.h +++ b/src/c/elementaryFunctions/includes/fix.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -35,6 +36,14 @@ EXTERN_ELEMFUNCT floatComplex cfixs(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zfixs(doubleComplex in); +EXTERN_ELEMFUNCT uint8 u8fixs(uint8 in); + +EXTERN_ELEMFUNCT int8 i8fixs(int8 in); + +EXTERN_ELEMFUNCT uint16 u16fixs(uint16 in); + +EXTERN_ELEMFUNCT int16 i16fixs(int16 in); + EXTERN_ELEMFUNCT void sfixa(float* in, int size, float* out); EXTERN_ELEMFUNCT void dfixa(double* in, int size, double* out); @@ -43,6 +52,14 @@ EXTERN_ELEMFUNCT void cfixa(floatComplex* in, int size, floatComplex* out); EXTERN_ELEMFUNCT void zfixa(doubleComplex* in, int size, doubleComplex* out); +EXTERN_ELEMFUNCT void u8fixa(uint8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8fixa(int8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16fixa(uint16* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16fixa(int16* in, int size, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/floor.h b/src/c/elementaryFunctions/includes/floor.h index 971cdf6..cd56641 100644 --- a/src/c/elementaryFunctions/includes/floor.h +++ b/src/c/elementaryFunctions/includes/floor.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -32,6 +33,14 @@ EXTERN_ELEMFUNCT floatComplex cfloors(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zfloors(doubleComplex in); +EXTERN_ELEMFUNCT uint8 u8floors(uint8 in); + +EXTERN_ELEMFUNCT int8 i8floors(int8 in); + +EXTERN_ELEMFUNCT uint16 u16floors(uint16 in); + +EXTERN_ELEMFUNCT int16 i16floors(int16 in); + EXTERN_ELEMFUNCT void sfloora(float* in, int size, float* out); EXTERN_ELEMFUNCT void dfloora(double* in, int size, double* out); @@ -40,6 +49,14 @@ EXTERN_ELEMFUNCT void cfloora(floatComplex* in, int size, floatComplex* out); EXTERN_ELEMFUNCT void zfloora(doubleComplex* in, int size, doubleComplex* out); +EXTERN_ELEMFUNCT void u8floora(uint8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8floora(int8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16floora(uint16* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16floora(int16* in, int size, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/round.h b/src/c/elementaryFunctions/includes/round.h index 1c3c0ce..6894265 100644 --- a/src/c/elementaryFunctions/includes/round.h +++ b/src/c/elementaryFunctions/includes/round.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -32,6 +33,14 @@ EXTERN_ELEMFUNCT floatComplex crounds(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zrounds(doubleComplex in); +EXTERN_ELEMFUNCT uint8 u8rounds(uint8 in); + +EXTERN_ELEMFUNCT int8 i8rounds(int8 in); + +EXTERN_ELEMFUNCT uint16 u16rounds(uint16 in); + +EXTERN_ELEMFUNCT int16 i16rounds(int16 in); + EXTERN_ELEMFUNCT void srounda(float* in, int size, float* out); EXTERN_ELEMFUNCT void drounda(double* in, int size, double* out); @@ -40,6 +49,14 @@ EXTERN_ELEMFUNCT void crounda(floatComplex* in, int size, floatComplex* out); EXTERN_ELEMFUNCT void zrounda(doubleComplex* in, int size, doubleComplex* out); +EXTERN_ELEMFUNCT void u8rounda(uint8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8rounda(int8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16rounda(uint16* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16rounda(int16* in, int size, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/interfaces/int_ceil.h b/src/c/elementaryFunctions/interfaces/int_ceil.h index 918dd5a..33c0176 100644 --- a/src/c/elementaryFunctions/interfaces/int_ceil.h +++ b/src/c/elementaryFunctions/interfaces/int_ceil.h @@ -23,6 +23,14 @@ #define z0ceilz0(in) zceils(in) +#define u80ceilu80(in) u8ceils(in) + +#define i80ceili80(in) i8ceils(in) + +#define u160ceilu160(in) u16ceils(in) + +#define i160ceili160(in) i16ceils(in) + #define s2ceils2(in,size,out) sceila(in, size[0]*size[1], out) #define d2ceild2(in,size,out) dceila(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2ceilz2(in,size,out) zceila(in, size[0]*size[1], out) +#define u82ceilu82(in,size,out) u8ceila(in, size[0]*size[1], out) + +#define i82ceili82(in,size,out) i8ceila(in, size[0]*size[1], out) + +#define u162ceilu162(in,size,out) u16ceila(in, size[0]*size[1], out) + +#define i162ceili162(in,size,out) i16ceila(in, size[0]*size[1], out) + #endif /* !__INT_CEIL_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_fix.h b/src/c/elementaryFunctions/interfaces/int_fix.h index ac483c9..2a00e2c 100644 --- a/src/c/elementaryFunctions/interfaces/int_fix.h +++ b/src/c/elementaryFunctions/interfaces/int_fix.h @@ -23,6 +23,14 @@ #define z0fixz0(in) zfixs(in) +#define u80fixu80(in) u8fixs(in) + +#define i80fixi80(in) i8fixs(in) + +#define u160fixu160(in) u16fixs(in) + +#define i160fixi160(in) i16fixs(in) + #define s2fixs2(in,size,out) sfixa(in, size[0]*size[1], out) #define d2fixd2(in,size,out) dfixa(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2fixz2(in,size,out) zfixa(in, size[0]*size[1], out) +#define u82fixu82(in,size,out) u8fixa(in, size[0]*size[1], out) + +#define i82fixi82(in,size,out) i8fixa(in, size[0]*size[1], out) + +#define u162fixu162(in,size,out) u16fixa(in, size[0]*size[1], out) + +#define i162fixi162(in,size,out) i16fixa(in, size[0]*size[1], out) + #endif /* !__INT_FIX_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_floor.h b/src/c/elementaryFunctions/interfaces/int_floor.h index 548c5e2..639819a 100644 --- a/src/c/elementaryFunctions/interfaces/int_floor.h +++ b/src/c/elementaryFunctions/interfaces/int_floor.h @@ -23,6 +23,14 @@ #define z0floorz0(in) zfloors(in) +#define u80flooru80(in) u8floors(in) + +#define i80floori80(in) i8floors(in) + +#define u160flooru160(in) u16floors(in) + +#define i160floori160(in) i16floors(in) + #define s2floors2(in,size,out) sfloora(in, size[0]*size[1], out) #define d2floord2(in,size,out) dfloora(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2floorz2(in,size,out) zfloora(in, size[0]*size[1], out) +#define u82flooru82(in,size,out) u8floora(in, size[0]*size[1], out) + +#define i82floori82(in,size,out) i8floora(in, size[0]*size[1], out) + +#define u162flooru162(in,size,out) u16floora(in, size[0]*size[1], out) + +#define i162floori162(in,size,out) i16floora(in, size[0]*size[1], out) + #endif /* !__INT_FLOOR_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_round.h b/src/c/elementaryFunctions/interfaces/int_round.h index a5da230..7d013c1 100644 --- a/src/c/elementaryFunctions/interfaces/int_round.h +++ b/src/c/elementaryFunctions/interfaces/int_round.h @@ -23,6 +23,14 @@ #define z0roundz0(in) zrounds(in) +#define u80roundu80(in) u8rounds(in) + +#define i80roundi80(in) i8rounds(in) + +#define u160roundu160(in) u16rounds(in) + +#define i160roundi160(in) i16rounds(in) + #define s2rounds2(in,size,out) srounda(in, size[0]*size[1], out) #define d2roundd2(in,size,out) drounda(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2roundz2(in,size,out) zrounda(in, size[0]*size[1], out) +#define u82roundu82(in,size,out) u8rounda(in, size[0]*size[1], out) + +#define i82roundi82(in,size,out) i8rounda(in, size[0]*size[1], out) + +#define u162roundu162(in,size,out) u16rounda(in, size[0]*size[1], out) + +#define i162roundi162(in,size,out) i16rounda(in, size[0]*size[1], out) + #endif /* !__INT_ROUND_H__ */ diff --git a/src/c/elementaryFunctions/round/i16rounda.c b/src/c/elementaryFunctions/round/i16rounda.c new file mode 100644 index 0000000..5cacafa --- /dev/null +++ b/src/c/elementaryFunctions/round/i16rounda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "round.h" + +void i16rounda(int16* x, int size, int16* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=i16rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/i16rounds.c b/src/c/elementaryFunctions/round/i16rounds.c new file mode 100644 index 0000000..95bd609 --- /dev/null +++ b/src/c/elementaryFunctions/round/i16rounds.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "round.h" + +int16 i16rounds(int16 x) { + int result; + + if(x>=0) result = (int16)((float)x+0.5); + else result = (int16)((float)x-0.5); + + return (int16)result; +} diff --git a/src/c/elementaryFunctions/round/i8rounda.c b/src/c/elementaryFunctions/round/i8rounda.c new file mode 100644 index 0000000..c47be51 --- /dev/null +++ b/src/c/elementaryFunctions/round/i8rounda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "round.h" + +void i8rounda(int8* x, int size, int8* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=i8rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/i8rounds.c b/src/c/elementaryFunctions/round/i8rounds.c new file mode 100644 index 0000000..f37d53c --- /dev/null +++ b/src/c/elementaryFunctions/round/i8rounds.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "round.h" + +int8 i8rounds(int8 x) { + int result; + + if(x>=0) result = (int8)((float)x+0.5); + else result = (int8)((float)x-0.5); + + return (int8)result; +} diff --git a/src/c/elementaryFunctions/round/u16rounda.c b/src/c/elementaryFunctions/round/u16rounda.c new file mode 100644 index 0000000..38c4b28 --- /dev/null +++ b/src/c/elementaryFunctions/round/u16rounda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "round.h" + +void u16rounda(uint16* x, int size, uint16* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=u16rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/u16rounds.c b/src/c/elementaryFunctions/round/u16rounds.c new file mode 100644 index 0000000..babda6d --- /dev/null +++ b/src/c/elementaryFunctions/round/u16rounds.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "round.h" + +uint16 u16rounds(uint16 x) { + int result; + + if(x>=0) result = (uint16)((float)x+0.5); + else result = (uint16)((float)x-0.5); + + return (uint16)result; +} diff --git a/src/c/elementaryFunctions/round/u8rounda.c b/src/c/elementaryFunctions/round/u8rounda.c new file mode 100644 index 0000000..e8f828d --- /dev/null +++ b/src/c/elementaryFunctions/round/u8rounda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "round.h" + +void u8rounda(uint8* x, int size, uint8* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=u8rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/u8rounds.c b/src/c/elementaryFunctions/round/u8rounds.c new file mode 100644 index 0000000..7e3da17 --- /dev/null +++ b/src/c/elementaryFunctions/round/u8rounds.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "round.h" + +uint8 u8rounds(uint8 x) { + int result; + + if(x>=0) result = (uint8)((float)x+0.5); + else result = (uint8)((float)x-0.5); + + return (uint8)result; +} diff --git a/src/c/matrixOperations/interfaces/int_ones.h b/src/c/matrixOperations/interfaces/int_ones.h index 3946a48..e266ee5 100644 --- a/src/c/matrixOperations/interfaces/int_ones.h +++ b/src/c/matrixOperations/interfaces/int_ones.h @@ -64,7 +64,7 @@ #define i80i80onesi82(in1,in2,out) i8onesa(out, in1, in2) -#define u160u160onesu82(in1,in2,out) u16onesa(out, in1, in2) +#define u160u160onesu162(in1,in2,out) u16onesa(out, in1, in2) #define i160i160onesi162(in1,in2,out) i16onesa(out, in1, in2) diff --git a/src/c/matrixOperations/interfaces/int_zeros.h b/src/c/matrixOperations/interfaces/int_zeros.h index 0f97af0..ac7e020 100644 --- a/src/c/matrixOperations/interfaces/int_zeros.h +++ b/src/c/matrixOperations/interfaces/int_zeros.h @@ -61,13 +61,13 @@ #define d0d0zerosd2(in1,in2,out) dzerosa(out, in1, in2) -#define u80u80zeross2(in1,in2,out) u80zerosa(out, in1, in2) +#define u80u80zerosu82(in1,in2,out) u8zerosa(out, in1, in2) -#define i80i80zeross2(in1,in2,out) i80zerosa(out, in1, in2) +#define i80i80zerosi82(in1,in2,out) i8zerosa(out, in1, in2) -#define u160u160zeross2(in1,in2,out) u160zerosa(out, in1, in2) +#define u160u160zerosu162(in1,in2,out) u16zerosa(out, in1, in2) -#define i160i160zeross2(in1,in2,out) i160zerosa(out, in1, in2) +#define i160i160zerosi162(in1,in2,out) i16zerosa(out, in1, in2) #define s2zeross2(in,size,out) szerosa(out, size[0], size[1]) diff --git a/src/c/operations/interfaces/int_OpLogAnd.h b/src/c/operations/interfaces/int_OpLogAnd.h index 460c81c..50a3189 100644 --- a/src/c/operations/interfaces/int_OpLogAnd.h +++ b/src/c/operations/interfaces/int_OpLogAnd.h @@ -19,6 +19,14 @@ #define Bool2Double(in) ((in) ? 1.0 : 0.0) +#define Bool2Uint8(in) ((in) ? (uint8)1 : (uint8)0) + +#define Bool2Int8(in) ((in) ? (int8)1 : (int8)0) + +#define Bool2Uint16(in) ((in) ? (uint16)1 : (uint16)0) + +#define Bool2Int16(in) ((in) ? (int16)1 : (int16)0) + /*scalar and scalar*/ #define s0s0OpLogAnds0(in1, in2) Bool2Float(in1 != 0.0 && in2 != 0.0) @@ -38,6 +46,15 @@ #define z0d0OpLogAndd0(in1, in2) Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && in2 != 0.0) +#define u80u80OpLogAndu80(in1, in2) Bool2Uint8(in1 != 0 && in2 != 0) + +#define i80i80OpLogAndi80(in1, in2) Bool2Int8(in1 != 0 && in2 != 0) + +#define u160u160OpLogAndu160(in1, in2) Bool2Uint16(in1 != 0 && in2 != 0) + +#define i160i160OpLogAndi160(in1, in2) Bool2Int16(in1 != 0 && in2 != 0) + + /*matrix and scalar*/ #define s2s0OpLogAnds2(in1, size1, in2, out) {int i = 0 ;\ @@ -65,6 +82,21 @@ #define z2d0OpLogAndd2(in1, size1, in2, out) {int i = 0 ;\ for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && in2 != 0.0);} +#define u82u80OpLogAndu82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 && in2 != 0);} + +#define i82i80OpLogAndi82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Int8(in1[i] != 0 && in2 != 0);} + +#define u82u80OpLogAndu82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 && in2 != 0);} + +#define u162u160OpLogAndu162(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint16(in1[i] != 0 && in2 != 0);} + +#define i162i160OpLogAndi162(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Int16(in1[i] != 0 && in2 != 0);} + /*scalar and matrix*/ #define s0s2OpLogAnds2(in1, in2, size2, out) {int i = 0 ;\ @@ -92,6 +124,18 @@ #define z0d2OpLogAndd2(in1, in2, size2, out) {int i = 0 ;\ for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && in2[i] != 0.0);} +#define u80u82OpLogAndu82(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1 != 0 && in2[i] != 0);} + +#define i80i82OpLogAndi82(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int8(in1 != 0 && in2[i] != 0);} + +#define u160u162OpLogAndu162(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint16(in1 != 0 && in2[i] != 0);} + +#define i160i162OpLogAndi162(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int16(in1 != 0 && in2[i] != 0);} + /*TODO matrix and matrix*/ #define s2s2OpLogAnds2(in1, size1, in2, size2, out) {int i = 0 ;\ @@ -119,4 +163,17 @@ #define z2d2OpLogAndd2(in1, size1, in2, size2, out) {int i = 0 ;\ for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && in2[i] != 0.0;)} + +#define u82u82OpLogAndu82(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 && in2[i] != 0);} + +#define i82i82OpLogAndi82(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int8(in1[i] != 0 && in2[i] != 0);} + +#define u162u162OpLogAndu162(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint16(in1[i] != 0 && in2[i] != 0);} + +#define i162i162OpLogAndi162(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int16(in1[i] != 0 && in2[i] != 0);} + #endif /* !__INT_OPLOGAND_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogEq.h b/src/c/operations/interfaces/int_OpLogEq.h index b15a8b6..446b11c 100644 --- a/src/c/operations/interfaces/int_OpLogEq.h +++ b/src/c/operations/interfaces/int_OpLogEq.h @@ -14,11 +14,17 @@ #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #define s0s0OpLogEqs0(in1,in2) (float) (in1 == in2) #define d0d0OpLogEqd0(in1,in2) (double) (in1 == in2) #define c0c0OpLogEqs0(in1,in2) (float) ((creals(in1) == creals(in2)) && (cimags(in1) == cimags(in2))) #define z0z0OpLogEqd0(in1,in2) (double) ((zreals(in1) == zreals(in2)) && (zimags(in1) == zimags(in2))) +#define u80u80OpLogEqu80(in1,in2) (uint8) (in1 == in2) +#define i80i80OpLogEqi80(in1,in2) (int8) (in1 == in2) +#define u160u160OpLogEqu160(in1,in2) (uint16) (in1 == in2) +#define i160i160OpLogEqi160(in1,in2) (int16) (in1 == in2) + #define s0c0OpLogEqs0(in1,in2) (float) ((in1==creals(in2)) && (0==cimags(in2))) #define d0z0OpLogEqd0(in1,in2) (double) ((in1==zreals(in2)) && (0==zimags(in2))) @@ -51,8 +57,21 @@ #define d2z0OpLogEqd2(in1,size,in2,out) {int i;\ for (i=0;i<size[0]*size[1];i++) out[i]=(double)((in1[i]==zreals(in2))&&(zimags(in2)==0));\ } +#define u82u80OpLogEqu82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(uint8)(in1[i]==in2);\ + } +#define i82i80OpLogEqi82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(int8)(in1[i]==in2);\ + } +#define u162u160OpLogEqu162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(uint16)(in1[i]==in2);\ + } + +#define i162i160OpLogEqi162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(int16)(in1[i]==in2);\ + } #define s0s2OpLogEqs2(in1,in2,inSize,out) s2s0OpLogEqs2(in2,inSize,in1,out) #define c0s2OpLogEqs2(in1,in2,inSize,out) s2c0OpLogEqs2(in2,inSize,in1,out) @@ -62,6 +81,11 @@ #define c0c2OpLogEqs2(in1,in2,inSize,out) c2c0OpLogEqs2(in2,inSize,in1,out) #define d0z2OpLogEqd2(in1,in2,inSize,out) z2d0OpLogEqd2(in2,inSize,in1,out) #define z0z2OpLogEqd2(in1,in2,inSize,out) z2z0OpLogEqd2(in2,inSize,in1,out) +#define u80u82OpLogEqu82(in1,in2,inSize,out) u82u80OpLogEqu82(in2,inSize,in1,out) +#define i80i82OpLogEqi82(in1,in2,inSize,out) i82i80OpLogEqi82(in2,inSize,in1,out) +#define u160u162OpLogEqu162(in1,in2,inSize,out) u162u160OpLogEq162(in2,inSize,in1,out) +#define i160i162OpLogEqi162(in1,in2,inSize,out) i162i160OpLogEqi162(in2,inSize,in1,out) + /* we must have size1=size2 */ @@ -91,4 +115,22 @@ #define c2s2OpLogEqs2(in1,size1,in2,size2,out) s2c2OpLogEqs2(in2,size2,in1,size1,out) #define z2d2OpLogEqd2(in1,size1,in2,size2,out) d2z2OpLogEqd2(in2,size2,in1,size1,out) -#endif /* !__OPLOGGT_H__ */ + +#define u82u82OpLogEqu82(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(uint8)(in1[i]==in2[i]);\ + } + +#define i82i82OpLogEqi82(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(int8)(in1[i]==in2[i]);\ + } + +#define u162u162OpLogEqu162(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(uint16)(in1[i]==in2[i]);\ + } + +#define i162i162OpLogEqi162(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(int16)(in1[i]==in2[i]);\ + } + + +#endif /* !__OPLOGEQ_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogGe.h b/src/c/operations/interfaces/int_OpLogGe.h index 0ce1ad8..edbdc07 100644 --- a/src/c/operations/interfaces/int_OpLogGe.h +++ b/src/c/operations/interfaces/int_OpLogGe.h @@ -21,15 +21,57 @@ #define s0s0OpLogGes0(in1,in2) (float) (in1 >= in2) #define d0d0OpLogGed0(in1,in2) (double) (in1 >= in2) +#define u80u80OpLogGeu80(in1,in2) (uint8) (in1 >= in2) + +#define i80i80OpLogGei80(in1,in2) (int8) (in1 >= in2) + +#define u160u160OpLogGeu160(in1,in2) (uint16) (in1 >= in2) + +#define i160i160OpLogGei160(in1,in2) (int16) (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 u82u80OpLogGeu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGeu80(in1[i],in2);\ + } + +#define i82i80OpLogGei82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogGei80(in1[i],in2);\ + } + +#define u82u80OpLogGeu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGeu80(in1[i],in2);\ + } + +#define u162u160OpLogGeu162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogGeu160(in1[i],in2);\ + } + +#define i162i160OpLogGei162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogGei160(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]);\ } +#define u80u82OpLogGeu82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u80u80OpLogGeu80(in1,in2[i]);\ + } + +#define u160u162OpLogGeu162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u160u160OpLogGeu160(in1,in2[i]);\ + } + + +#define i160i162OpLogGei162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i160i160OpLogGei160(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]);\ @@ -47,4 +89,22 @@ #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]);\ } + +#define u82u82OpLogGeu82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGeu80(in1[i],in2[i]);\ + } + +#define i82i82OpLogGei82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogGei80(in1[i],in2[i]);\ + } + +#define u162u162OpLogGeu162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogGeu160(in1[i],in2[i]);\ + } + +#define i162i162OpLogGei162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogGei160(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 index 161b654..38c76cf 100644 --- a/src/c/operations/interfaces/int_OpLogGt.h +++ b/src/c/operations/interfaces/int_OpLogGt.h @@ -21,15 +21,51 @@ #define s0s0OpLogGts0(in1,in2) (float) (in1 > in2) #define d0d0OpLogGtd0(in1,in2) (double) (in1 > in2) +#define u80u80OpLogGtu80(in1,in2) (uint8) (in1 > in2) +#define i80i80OpLogGti80(in1,in2) (int8) (in1 > in2) +#define u160u160OpLogGtu160(in1,in2) (uint16) (in1 > in2) +#define i160i160OpLogGti160(in1,in2) (int16) (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 u82u80OpLogGtu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGtu80(in1[i],in2);\ + } + +#define i82i80OpLogGti82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogGti80(in1[i],in2);\ + } + +#define u162u160OpLogGtu162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogGtu160(in1[i],in2);\ + } + +#define i162i160OpLogGti162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogGti160(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]);\ } +#define u80u82OpLogGtu82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u80u80OpLogGtu80(in1,in2[i]);\ + } + +#define i80i82OpLogGti82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i80i80OpLogGti80(in1,in2[i]);\ + } + +#define u160u162OpLogGtu162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u160u160OpLogGtu160(in1,in2[i]);\ + } + +#define i160i162OpLogGti162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i160i160OpLogGti160(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]);\ @@ -47,4 +83,21 @@ #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]);\ } + +#define u82u82OpLogGtu82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGtu80(in1[i],in2[i]);\ + } + +#define i82i82OpLogGti82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogGti80(in1[i],in2[i]);\ + } + +#define u162u162OpLogGtu162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogGt160(in1[i],in2[i]);\ + } + +#define i162i162OpLogGti162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogGti160(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 index ebb09c7..8dbd1aa 100644 --- a/src/c/operations/interfaces/int_OpLogLe.h +++ b/src/c/operations/interfaces/int_OpLogLe.h @@ -20,16 +20,51 @@ #define s0s0OpLogLes0(in1,in2) (float) (in1 <= in2) #define d0d0OpLogLed0(in1,in2) (double) (in1 <= in2) - +#define u80u80OpLogLeu80(in1,in2) (uint8) (in1 <= in2) +#define i80i80OpLogLei80(in1,in2) (int8) (in1 <= in2) +#define u160u160OpLogLeu160(in1,in2) (uint16) (in1 <= in2) +#define i160i160OpLogLei160(in1,in2) (int16) (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 u82u80OpLogLeu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogLeu80(in1[i],in2);\ + } + +#define i82i80OpLogLei82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogLei80(in1[i],in2);\ + } + +#define u162u160OpLogLeu162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogLeu160(in1[i],in2);\ + } + +#define i162i160OpLogLei162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogLei160(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]);\ } +#define u80u82OpLogLeu82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u80u80OpLogLeu80(in1,in2[i]);\ + } + +#define i80i82OpLogLei82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i80i80OpLogLei80(in1,in2[i]);\ + } + +#define u160u162OpLogLeu162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u160u160OpLogLeu160(in1,in2[i]);\ + } + +#define i160i162OpLogLei162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i160i160OpLogLei160(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]);\ @@ -47,4 +82,21 @@ #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]);\ } + +#define u82u82OpLogLeu82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogLeu80(in1[i],in2[i]);\ + } + +#define i82i82OpLogLei82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogLei80(in1[i],in2[i]);\ + } + +#define u162u162OpLogLeu162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogLeu160(in1[i],in2[i]);\ + } + +#define i162i162OpLogLei162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogLei160(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 index 2c5d863..8974b15 100644 --- a/src/c/operations/interfaces/int_OpLogLt.h +++ b/src/c/operations/interfaces/int_OpLogLt.h @@ -20,16 +20,51 @@ #define s0s0OpLogLts0(in1,in2) (float) (in1 < in2) #define d0d0OpLogLtd0(in1,in2) (double) (in1 < in2) - +#define u80u80OpLogLtu80(in1,in2) (uint8) (in1 < in2) +#define i80i80OpLogLti80(in1,in2) (int8) (in1 < in2) +#define u160u160OpLogLtu160(in1,in2) (uint16) (in1 < in2) +#define i160i160OpLogLti160(in1,in2) (int16) (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 u82u80OpLogLtu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogLtu80(in1[i],in2);\ + } + +#define i82i80OpLogLti82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogLti80(in1[i],in2);\ + } + +#define u162u160OpLogLtu162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogLtu160(in1[i],in2);\ + } + +#define i162i160OpLogLti162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogLti160(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]);\ } +#define u80u82OpLogLtu82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u80u80OpLogLtu80(in1,in2[i]);\ + } + +#define i80i82OpLogLti82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i80i80OpLogLti80(in1,in2[i]);\ + } + +#define u160u162OpLogLtu162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u160u160OpLogLtu160(in1,in2[i]);\ + } + +#define i160i162OpLogLti162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i160i160OpLogLti160(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]);\ @@ -47,4 +82,21 @@ #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]);\ } + +#define u82u82OpLogLtu82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogLtu80(in1[i],in2[i]);\ + } + +#define i82i82OpLogLti82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogLti80(in1[i],in2[i]);\ + } + +#define u162u162OpLogLtu162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogLtu160(in1[i],in2[i]);\ + } + +#define i162i162OpLogLti162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogLti160(in1[i],in2[i]);\ + } + #endif /* !__OPLOGLT_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogNe.h b/src/c/operations/interfaces/int_OpLogNe.h index 238ef48..56cafef 100644 --- a/src/c/operations/interfaces/int_OpLogNe.h +++ b/src/c/operations/interfaces/int_OpLogNe.h @@ -22,6 +22,10 @@ #define d0d0OpLogNed0(in1,in2) (double) !(in1 == in2) #define c0c0OpLogNes0(in1,in2) (float) !((creals(in1) == creals(in2)) && (cimags(in1) == cimags(in2))) #define z0z0OpLogNed0(in1,in2) (double) !((zreals(in1) == zreals(in2)) && (zimags(in1) == zimags(in2))) +#define u80u80OpLogNeu80(in1,in2) (uint8) !(in1 == in2) +#define i80i80OpLogNei80(in1,in2) (int8) !(in1 == in2) +#define u160u160OpLogNeu160(in1,in2) (uint16) !(in1 == in2) +#define i160i160OpLogNei160(in1,in2) (int16) !(in1 == in2) #define s0c0OpLogNes0(in1,in2) (float) !((in1==creals(in2)) && (0==cimags(in2))) #define d0z0OpLogNed0(in1,in2) (double) !((in1==zreals(in2)) && (0==zimags(in2))) @@ -55,7 +59,21 @@ for (i=0;i<size[0]*size[1];i++) out[i]=(double)!((in1[i]==zreals(in2))&&(zimags(in2)==0));\ } +#define u82u80OpLogNeu82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(uint8)!(in1[i]==in2);\ + } + +#define i82i80OpLogNei82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(int8)!(in1[i]==in2);\ + } +#define u162u160OpLogNeu162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(uint16)!(in1[i]==in2);\ + } + +#define i162i160OpLogNei162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(int16)!(in1[i]==in2);\ + } #define s0s2OpLogNes2(in1,in2,inSize,out) s2s0OpLogNes2(in2,inSize,in1,out) #define c0s2OpLogNes2(in1,in2,inSize,out) s2c0OpLogNes2(in2,inSize,in1,out) @@ -65,6 +83,10 @@ #define c0c2OpLogNes2(in1,in2,inSize,out) c2c0OpLogNes2(in2,inSize,in1,out) #define d0z2OpLogNed2(in1,in2,inSize,out) z2d0OpLogNed2(in2,inSize,in1,out) #define z0z2OpLogNed2(in1,in2,inSize,out) z2z0OpLogNed2(in2,inSize,in1,out) +#define u80u82OpLogNeu82(in1,in2,inSize,out) u82u80OpLogNeu82(in2,inSize,in1,out) +#define i80i82OpLogNei82(in1,in2,inSize,out) i82i80OpLogNei82(in2,inSize,in1,out) +#define u160u162OpLogNeu162(in1,in2,inSize,out) u162u160OpLogNeu162(in2,inSize,in1,out) +#define i160i162OpLogNei162(in1,in2,inSize,out) i162i160OpLogNei162(in2,inSize,in1,out) /* we must have size1=size2 */ @@ -95,4 +117,20 @@ #define c2s2OpLogNes2(in1,size1,in2,size2,out) s2c2OpLogNes2(in2,size2,in1,size1,out) #define z2d2OpLogNed2(in1,size1,in2,size2,out) d2z2OpLogNed2(in2,size2,in1,size1,out) +#define u82u82OpLogNeu82(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(uint8)!(in1[i]==in2[i]);\ + } + +#define i82i82OpLogNei82(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(int8)!(in1[i]==in2[i]);\ + } + +#define u162u162OpLogNeu162(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(uint16)!(in1[i]==in2[i]);\ + } + +#define i162i162OpLogNei162(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(int16)!(in1[i]==in2[i]);\ + } + #endif /* !__OPLOGNE_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogOr.h b/src/c/operations/interfaces/int_OpLogOr.h index b5d55fb..5618ff6 100644 --- a/src/c/operations/interfaces/int_OpLogOr.h +++ b/src/c/operations/interfaces/int_OpLogOr.h @@ -19,6 +19,14 @@ #define Bool2Double(in) ((in) ? 1.0 : 0.0) +#define Bool2Uint8(in) ((in) ? (uint8)1 : (uint8)0) + +#define Bool2Int8(in) ((in) ? (int8)1 : (int8)0) + +#define Bool2Uint16(in) ((in) ? (uint16)1 : (uint16)0) + +#define Bool2Int16(in) ((in) ? (int16)1 : (int16)0) + /*scalar or scalar */ #define s0s0OpLogOrs0(in1, in2) Bool2Float(in1 != 0.0f || in2 != 0.0f) @@ -37,6 +45,14 @@ #define z0d0OpLogOrd0(in1, in2) Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && in2 != 0.0) +#define u80u80OpLogOru80(in1, in2) Bool2Uint8(in1 != 0 || in2 != 0) + +#define i80i80OpLogOri80(in1, in2) Bool2Int8(in1 != 0 || in2 != 0) + +#define u160u160OpLogOru160(in1, in2) Bool2Uint16(in1 != 0 || in2 != 0) + +#define i160i160OpLogOri160(in1, in2) Bool2Int16(in1 != 0 || in2 != 0) + /*matrix or scalar */ #define s2s0OpLogOrs2(in1, size1, in2, out) {int i = 0 ;\ @@ -63,6 +79,19 @@ #define z2d0OpLogOrd2(in1, size1, in2, out) {int i = 0 ;\ for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && in2 != 0.0);} +#define i82i80OpLogOri82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Int8(in1[i] != 0 || in2 != 0);} + +#define u82u80OpLogOru82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 || in2 != 0);} + +#define u162u160OpLogOru162(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint16(in1[i] != 0 || in2 != 0);} + +#define i162i160OpLogOri162(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Int16(in1[i] != 0 || in2 != 0);} + + /*scalar or matrix */ #define s0s2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ @@ -88,6 +117,19 @@ #define z0d2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.2 || zimags(in1) != 0.2) && in2[i] != 0.2);} + +#define u80u82OpLogOru82(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1 != 0 || in2[i] != 0);} + +#define i80i82OpLogOri82(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int8(in1 != 0 || in2[i] != 0);} + +#define u160u162OpLogOru162(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint16(in1 != 0 || in2[i] != 0);} + +#define i160i162OpLogOri162(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int16(in1 != 0 || in2[i] != 0);} + /*matrix or matrix */ #define s2s2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ @@ -113,4 +155,17 @@ #define z2d2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.2 || zimags(in1[i]) != 0.2) && in2[i] != 0.2);} + +#define u82u82OpLogOru82(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 || in2[i] != 0);} + +#define i82i82OpLogOri82(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int8(in1[i] != 0 || in2[i] != 0);} + +#define u162u162OpLogOru162(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint16(in1[i] != 0 || in2[i] != 0);} + +#define i162i162OpLogOri162(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int16(in1[i] != 0 || in2[i] != 0);} + #endif /* !__INT_OPLOGOR_H__ */ diff --git a/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c b/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c new file mode 100644 index 0000000..ebfad61 --- /dev/null +++ b/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include "cmd_analog_in.h" + +uint16 u8cmd_analog_ins(uint8 board_no, uint8 pin) +{ + return((uint16)analogRead(pin)); +} + diff --git a/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c b/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c new file mode 100644 index 0000000..94d51f6 --- /dev/null +++ b/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include "cmd_analog_out.h" + +uint8 u8cmd_analog_outs(uint8 board_no, uint8 pin, uint8 value) +{ + analogWrite(pin,value); + return 0; +} + diff --git a/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c b/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c new file mode 100644 index 0000000..1d0036a --- /dev/null +++ b/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include "cmd_digital_in.h" + +uint8 u8cmd_digital_ins(uint8 board_no, uint8 pin) +{ + return((uint8)digitalRead(pin)); +} + diff --git a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c new file mode 100644 index 0000000..09dffd6 --- /dev/null +++ b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include "cmd_digital_out.h" + +uint8 u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value) +{ + digitalWrite(pin,value); + return 0; +} + diff --git a/src/c/scilab-arduino/includes/cmd_analog_in.h b/src/c/scilab-arduino/includes/cmd_analog_in.h new file mode 100644 index 0000000..5361fe8 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_analog_in.h @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __CMD_ANALOG_IN_H__ +#define __CMD_ANALOG_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 u8cmd_analog_ins(uint8 board_no, uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_IN_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_analog_out.h b/src/c/scilab-arduino/includes/cmd_analog_out.h new file mode 100644 index 0000000..d7fca53 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_analog_out.h @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __CMD_ANALOG_OUT_H__ +#define __CMD_ANALOG_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8cmd_analog_outs(uint8 board_no, uint8 pin, uint8 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_ANALOG_OUT_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_digital_in.h b/src/c/scilab-arduino/includes/cmd_digital_in.h new file mode 100644 index 0000000..96fd24b --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_digital_in.h @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __CMD_DIGITAL_IN_H__ +#define __CMD_DIGITAL_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8cmd_digital_ins(uint8 board_no, uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_IN_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_digital_out.h b/src/c/scilab-arduino/includes/cmd_digital_out.h new file mode 100644 index 0000000..ee459d1 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_digital_out.h @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __CMD_DIGITAL_OUT_H__ +#define __CMD_DIGITAL_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/includes/sleep.h b/src/c/scilab-arduino/includes/sleep.h new file mode 100644 index 0000000..2e2940a --- /dev/null +++ b/src/c/scilab-arduino/includes/sleep.h @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __SLEEP_H__ +#define __SLEEP_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u16sleeps(uint16 delay_ms); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h new file mode 100644 index 0000000..0df8fcb --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h @@ -0,0 +1,30 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __INT_CMD_ANALOG_IN_H__ +#define __INT_CMD_ANALOG_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_analog_inu160(in1,in2) u8cmd_analog_ins((uint8)in1,\ + (uint8)in2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_ANALOG_IN_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h new file mode 100644 index 0000000..d6b16f8 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h @@ -0,0 +1,30 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __INT_CMD_ANALOG_OUT_H__ +#define __INT_CMD_ANALOG_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_digital_outu80(in1,in2,in3) u8cmd_analog_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h b/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h new file mode 100644 index 0000000..04b773c --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h @@ -0,0 +1,30 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __INT_CMD_DIGITAL_IN_H__ +#define __INT_CMD_DIGITAL_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_digital_inu80(in1,in2) u8cmd_digital_ins((uint8)in1,\ + (uint8)in2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_IN_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h b/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h new file mode 100644 index 0000000..a3d1eab --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h @@ -0,0 +1,30 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __INT_CMD_DIGITAL_OUT_H__ +#define __INT_CMD_DIGITAL_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_digital_outu80(in1,in2,in3) u8cmd_digital_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_sleep.h b/src/c/scilab-arduino/interfaces/int_sleep.h new file mode 100644 index 0000000..8e2d082 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_sleep.h @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __INT_SLEEP_H__ +#define __INT_sLEEP_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0sleepu80(in1) u16sleeps((uint16)in1) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_SLEEP_H__ */ diff --git a/src/c/scilab-arduino/sleep/u16sleeps.c b/src/c/scilab-arduino/sleep/u16sleeps.c new file mode 100644 index 0000000..14da0ba --- /dev/null +++ b/src/c/scilab-arduino/sleep/u16sleeps.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include "sleep.h" + +uint8 u16sleeps(uint16 delay_ms) +{ + delay(delay_ms); + return 0; +} + diff --git a/src/c/type/int_imag.h b/src/c/type/int_imag.h index 9647f6a..6e6b736 100644 --- a/src/c/type/int_imag.h +++ b/src/c/type/int_imag.h @@ -23,6 +23,14 @@ #define z0imagd0(in) zimags(in) +#define u80imagu80(in) 0 + +#define i80imagi80(in) 0 + +#define u160imagu160(in) 0 + +#define i160imagi160(in) 0 + #define s2imags2(in,size,out) szerosa(out,size[0],size[1]) #define d2imagd2(in,size,out) dzerosa(out,size[0],size[1]) @@ -31,4 +39,12 @@ #define z2imagd2(in,size,out) zimaga(in, size[0]*size[1], out) +#define u82imagu82(in,size,out) u8zerosa(out,size[0],size[1]) + +#define i82imagi82(in,size,out) i8zerosa(out,size[0],size[1]) + +#define u162imagu162(in,size,out) u16zerosa(out,size[0],size[1]) + +#define i162imagi162(in,size,out) i16zerosa(out,size[0],size[1]) + #endif /* !__INT_IMAG_H__ */ diff --git a/src/c/type/int_real.h b/src/c/type/int_real.h index 4949b88..ce097ec 100644 --- a/src/c/type/int_real.h +++ b/src/c/type/int_real.h @@ -23,6 +23,14 @@ #define z0reald0(in) zreals(in) +#define u80realu80(in) in + +#define i80reali80(in) in + +#define u160realu160(in) in + +#define i160reali160(in) in + #define s2reals2(in,size,out) {int i;\ for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ } @@ -35,4 +43,19 @@ #define z2reald2(in,size,out) zreala(in, size[0]*size[1],out) +#define u82realu82(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ + } + +#define i82reali82(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ + } +#define u162realu162(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ + } + +#define i162reali162(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ + } + #endif /* !__INT_REAL_H__ */ |