diff options
Diffstat (limited to 'src/c/operations')
69 files changed, 2123 insertions, 24 deletions
diff --git a/src/c/operations/addition/i16adda.c b/src/c/operations/addition/i16adda.c new file mode 100644 index 00000000..db85675a --- /dev/null +++ b/src/c/operations/addition/i16adda.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +void i16adda(int16* in1, int size1, int16* in2, int size2, int16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i16adds(in1[i], in2[i]); + } +} diff --git a/src/c/operations/addition/i16adds.c b/src/c/operations/addition/i16adds.c new file mode 100644 index 00000000..88c927d4 --- /dev/null +++ b/src/c/operations/addition/i16adds.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +int16 i16adds(int16 in1, int16 in2) +{ + return (in1 + in2); +} diff --git a/src/c/operations/addition/i8adda.c b/src/c/operations/addition/i8adda.c new file mode 100644 index 00000000..5e556d35 --- /dev/null +++ b/src/c/operations/addition/i8adda.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +void i8adda(int8* in1, int size1, int8* in2, int size2, int8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i8adds(in1[i], in2[i]); + } +} diff --git a/src/c/operations/addition/i8adds.c b/src/c/operations/addition/i8adds.c new file mode 100644 index 00000000..0520912b --- /dev/null +++ b/src/c/operations/addition/i8adds.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +int8 i8adds(int8 in1, int8 in2) +{ + return (in1 + in2); +} diff --git a/src/c/operations/addition/u16adda.c b/src/c/operations/addition/u16adda.c new file mode 100644 index 00000000..3884aa3c --- /dev/null +++ b/src/c/operations/addition/u16adda.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +void u16adda(uint16* in1, int size1, uint16* in2, int size2, uint16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u16adds(in1[i], in2[i]); + } +} diff --git a/src/c/operations/addition/u16adds.c b/src/c/operations/addition/u16adds.c new file mode 100644 index 00000000..2d49e905 --- /dev/null +++ b/src/c/operations/addition/u16adds.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +uint16 u16adds(uint16 in1, uint16 in2) +{ + return (in1 + in2); +} diff --git a/src/c/operations/addition/u8adda.c b/src/c/operations/addition/u8adda.c new file mode 100644 index 00000000..01c7608b --- /dev/null +++ b/src/c/operations/addition/u8adda.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +void u8adda(uint8* in1, int size1, uint8* in2, int size2, uint8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u8adds(in1[i], in2[i]); + } +} diff --git a/src/c/operations/addition/u8adds.c b/src/c/operations/addition/u8adds.c new file mode 100644 index 00000000..ad258232 --- /dev/null +++ b/src/c/operations/addition/u8adds.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +uint8 u8adds(uint8 in1, uint8 in2) +{ + return (in1 + in2); +} diff --git a/src/c/operations/addition/zadds.c b/src/c/operations/addition/zadds.c index d4a94dc5..768faf38 100644 --- a/src/c/operations/addition/zadds.c +++ b/src/c/operations/addition/zadds.c @@ -11,6 +11,7 @@ */ #include "addition.h" +#include "doubleComplex.h" doubleComplex zadds(doubleComplex z1, doubleComplex z2) { return DoubleComplex(zreals(z1) + zreals(z2), diff --git a/src/c/operations/division/cldiva.c b/src/c/operations/division/cldiva.c index 21d95e31..73b94f28 100644 --- a/src/c/operations/division/cldiva.c +++ b/src/c/operations/division/cldiva.c @@ -15,7 +15,8 @@ void cldiva (floatComplex* in1, floatComplex* in2, int size, floatComplex* out ){ int i=0; - for (i=0;i<size;i++){ + for (i=0;i<size;i++) + { out[i]=cldivs(in1[i],in2[i]); } } diff --git a/src/c/operations/division/crdiva.c b/src/c/operations/division/crdiva.c index 86676bd5..ea9781e8 100644 --- a/src/c/operations/division/crdiva.c +++ b/src/c/operations/division/crdiva.c @@ -15,7 +15,8 @@ void crdiva (floatComplex* in1, floatComplex* in2, int size, floatComplex* out ){ int i=0; - for (i=0;i<size;i++){ + for (i=0;i<size;i++) + { out[i]=crdivs(in1[i],in2[i]); } } diff --git a/src/c/operations/division/i16ldiva.c b/src/c/operations/division/i16ldiva.c new file mode 100644 index 00000000..4106acf1 --- /dev/null +++ b/src/c/operations/division/i16ldiva.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void i16ldiva (int16* in1, int16* in2, int size, int16* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i16ldivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/i16ldivs.c b/src/c/operations/division/i16ldivs.c new file mode 100644 index 00000000..d807e491 --- /dev/null +++ b/src/c/operations/division/i16ldivs.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +int16 i16ldivs (int16 in1, int16 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/i16rdiva.c b/src/c/operations/division/i16rdiva.c new file mode 100644 index 00000000..149e8efb --- /dev/null +++ b/src/c/operations/division/i16rdiva.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void i16rdiva (int16* in1, int16* in2, int size, int16* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i16rdivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/i16rdivs.c b/src/c/operations/division/i16rdivs.c new file mode 100644 index 00000000..418e5704 --- /dev/null +++ b/src/c/operations/division/i16rdivs.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +int16 i16rdivs (int16 in1, int16 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/i8ldiva.c b/src/c/operations/division/i8ldiva.c new file mode 100644 index 00000000..b7e0a7b9 --- /dev/null +++ b/src/c/operations/division/i8ldiva.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "division.h" + +void i8ldiva (int8* in1, int8* in2, int size, int8* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i8ldivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/i8ldivs.c b/src/c/operations/division/i8ldivs.c new file mode 100644 index 00000000..65b2ff89 --- /dev/null +++ b/src/c/operations/division/i8ldivs.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +int8 i8ldivs (int8 in1, int8 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/i8rdiva.c b/src/c/operations/division/i8rdiva.c new file mode 100644 index 00000000..f3be2a03 --- /dev/null +++ b/src/c/operations/division/i8rdiva.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void i8rdiva (int8* in1, int8* in2, int size, int8* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i8rdivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/i8rdivs.c b/src/c/operations/division/i8rdivs.c new file mode 100644 index 00000000..54e39554 --- /dev/null +++ b/src/c/operations/division/i8rdivs.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +int8 i8rdivs (int8 in1, int8 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/u16ldiva.c b/src/c/operations/division/u16ldiva.c new file mode 100644 index 00000000..bc24ab05 --- /dev/null +++ b/src/c/operations/division/u16ldiva.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void u16ldiva (uint16* in1, uint16* in2, int size, uint16* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u16ldivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/u16ldivs.c b/src/c/operations/division/u16ldivs.c new file mode 100644 index 00000000..b1d85182 --- /dev/null +++ b/src/c/operations/division/u16ldivs.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +uint16 u16ldivs (uint16 in1, uint16 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/u16rdiva.c b/src/c/operations/division/u16rdiva.c new file mode 100644 index 00000000..a13deccb --- /dev/null +++ b/src/c/operations/division/u16rdiva.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void u16rdiva (uint16* in1, uint16* in2, int size, uint16* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u16rdivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/u16rdivs.c b/src/c/operations/division/u16rdivs.c new file mode 100644 index 00000000..d55c07f4 --- /dev/null +++ b/src/c/operations/division/u16rdivs.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +uint16 u16rdivs (uint16 in1, uint16 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/u8ldiva.c b/src/c/operations/division/u8ldiva.c new file mode 100644 index 00000000..8dc948f9 --- /dev/null +++ b/src/c/operations/division/u8ldiva.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void u8ldiva (uint8* in1, uint8* in2, int size, uint8* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u8ldivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/u8ldivs.c b/src/c/operations/division/u8ldivs.c new file mode 100644 index 00000000..bf16943f --- /dev/null +++ b/src/c/operations/division/u8ldivs.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +uint8 u8ldivs (uint8 in1, uint8 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/u8rdiva.c b/src/c/operations/division/u8rdiva.c new file mode 100644 index 00000000..7ed7f9cc --- /dev/null +++ b/src/c/operations/division/u8rdiva.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void u8rdiva (uint8* in1, uint8* in2, int size, uint8* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u8rdivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/u8rdivs.c b/src/c/operations/division/u8rdivs.c new file mode 100644 index 00000000..9d04ebfa --- /dev/null +++ b/src/c/operations/division/u8rdivs.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +uint8 u8rdivs (uint8 in1, uint8 in2){ + return in1/in2; +} diff --git a/src/c/operations/includes/addition.h b/src/c/operations/includes/addition.h index d6f03381..fbf0177b 100644 --- a/src/c/operations/includes/addition.h +++ b/src/c/operations/includes/addition.h @@ -16,6 +16,7 @@ #include "dynlib_operations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -108,6 +109,86 @@ EXTERN_OPERATIONS void zadda(doubleComplex *in1, int size1, doubleComplex *in2, int size2, doubleComplex *out); +/* +** \brief Compute an addition with uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS uint8 u8adds(uint8 in1, uint8 in2); + +/* +** \brief Compute an addition element wise for uint8. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the addition in1 + in2. +*/ +EXTERN_OPERATIONS void u8adda(uint8 *in1, int size1, + uint8 *in2, int size2, + uint8 *out); + +/* +** \brief Compute an addition with int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS int8 i8adds(int8 in1, int8 in2); + +/* +** \brief Compute an addition element wise for int8. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the addition in1 + in2. +*/ +EXTERN_OPERATIONS void i8adda(int8 *in1, int size1, + int8 *in2, int size2, + int8 *out); + +/* +** \brief Compute an addition with uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS uint16 u16adds(uint16 in1, uint16 in2); + +/* +** \brief Compute an addition element wise for uint16. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the addition in1 + in2. +*/ +EXTERN_OPERATIONS void u16adda(uint16 *in1, int size1, + uint16 *in2, int size2, + uint16 *out); + +/* +** \brief Compute an addition with int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS int16 i16adds(int16 in1, int16 in2); + +/* +** \brief Compute an addition element wise for int16. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the addition in1 + in2. +*/ +EXTERN_OPERATIONS void i16adda(int16 *in1, int size1, + int16 *in2, int size2, + int16 *out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/operations/includes/division.h b/src/c/operations/includes/division.h index df4c5d2a..ac2d1482 100644 --- a/src/c/operations/includes/division.h +++ b/src/c/operations/includes/division.h @@ -16,6 +16,7 @@ #include "dynlib_operations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -101,6 +102,80 @@ EXTERN_OPERATIONS doubleComplex zrdivs (doubleComplex in1, doubleComplex in2); */ EXTERN_OPERATIONS void zrdiva(doubleComplex* in1, doubleComplex* in2, int size, doubleComplex* out ); + +/* +** \brief Compute a right division element ways for uint8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 ./ in2. +*/ +EXTERN_OPERATIONS void u8rdiva (uint8* in1, uint8* in2, int size, uint8* out ); + + + +/* +** \brief Compute a right division for uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return in1 / in2 = in1 ./ in2. +*/ + +EXTERN_OPERATIONS uint8 u8rdivs (uint8 in1, uint8 in2); + +/* +** \brief Compute a right division element ways for uint16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 ./ in2. +*/ +EXTERN_OPERATIONS void u16rdiva (uint16* in1, uint16* in2, int size, uint16* out ); + + +/* +** \brief Compute a right division element ways for int8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 ./ in2. +*/ +EXTERN_OPERATIONS void i8rdiva (int8* in1, int8* in2, int size, int8* out ); + +/* +** \brief Compute a right division for int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS int8 i8rdivs (int8 in1, int8 in2); + +/* +** \brief Compute a right division for uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS uint16 u16rdivs (uint16 in1, uint16 in2); + +/* +** \brief Compute a right division for int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS int16 i16rdivs (int16 in1, int16 in2); + +/* +** \brief Compute a right division element ways for int16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 ./ in2. +*/ +EXTERN_OPERATIONS void i16rdiva (int16* in1, int16* in2, int size, int16* out ); + + /* ** LEFT DIVISION */ @@ -173,6 +248,78 @@ EXTERN_OPERATIONS doubleComplex zldivs (doubleComplex in1, doubleComplex in2); */ EXTERN_OPERATIONS void zldiva(doubleComplex* in1, doubleComplex* in2, int size, doubleComplex* out ); +/* +** \brief Compute a left division element ways for uint8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 .\ in2. +*/ +EXTERN_OPERATIONS void u8ldiva (uint8* in1, uint8* in2, int size, uint8* out ); + +/* +** \brief Compute a right division for uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS uint8 u8ldivs (uint8 in1, uint8 in2); + +/* +** \brief Compute a left division element ways for int8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 .\ in2. +*/ +EXTERN_OPERATIONS void i8ldiva (int8* in1, int8* in2, int size, int8* out ); + +/* +** \brief Compute a right division for int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS int8 i8ldivs (int8 in1, int8 in2); + +/* +** \brief Compute a left division element ways for uint16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 .\ in2. +*/ +EXTERN_OPERATIONS void u16ldiva (uint16* in1, uint16* in2, int size, uint16* out ); + + +/* +** \brief Compute a right division for uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS uint16 u16ldivs (uint16 in1, uint16 in2); + +/* +** \brief Compute a left division element ways for int16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 .\ in2. +*/ +EXTERN_OPERATIONS void i16ldiva (int16* in1, int16* in2, int size, int16* out ); + + +/* +** \brief Compute a right division for int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS int16 i16ldivs (int16 in1, int16 in2); + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/operations/includes/multiplication.h b/src/c/operations/includes/multiplication.h index 9931a9a9..32ea932b 100644 --- a/src/c/operations/includes/multiplication.h +++ b/src/c/operations/includes/multiplication.h @@ -16,6 +16,7 @@ #include "dynlib_operations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -140,6 +141,111 @@ EXTERN_OPERATIONS doubleComplex zmulzdv(doubleComplex *in1, double *in2, int siz EXTERN_OPERATIONS doubleComplex zmuldzv(double *in1, doubleComplex *in2, int size2); +/* +** \brief Compute a multiplication element ways for uint8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \param out : array that contains the multiplication = in1 .* in2. +*/ +EXTERN_OPERATIONS void u8mula(uint8 *in1, uint8 *in2, int size,uint8 * out); + +/* +** \brief Compute a multiplication with uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return : in1 * in 2 = in1 .* in2. +*/ +EXTERN_OPERATIONS uint8 u8muls(uint8 in1, uint8 in2); + +/* +** \brief Compute a multiplication for uint8 arrays. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the multiplication of the two vectors = in1 .* in2. +*/ +EXTERN_OPERATIONS uint8 u8mulv(uint8 *in1, uint8 *in2, int size2); + +/* +** \brief Compute a multiplication element ways for int8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \param out : array that contains the multiplication = in1 .* in2. +*/ +EXTERN_OPERATIONS void i8mula(int8 *in1, int8 *in2, int size,int8 * out); + +/* +** \brief Compute a multiplication with int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return : in1 * in 2 = in1 .* in2. +*/ +EXTERN_OPERATIONS int8 i8muls(int8 in1, int8 in2); + +/* +** \brief Compute a multiplication for int8 arrays. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the multiplication of the two vectors = in1 .* in2. +*/ +EXTERN_OPERATIONS int8 i8mulv(int8 *in1, int8 *in2, int size2); + +/* +** \brief Compute a multiplication element ways for uint16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \param out : array that contains the multiplication = in1 .* in2. +*/ +EXTERN_OPERATIONS void u16mula(uint16 *in1, uint16 *in2, int size,uint16 * out); + +/* +** \brief Compute a multiplication with uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return : in1 * in 2 = in1 .* in2. +*/ +EXTERN_OPERATIONS uint16 u16muls(uint16 in1, uint16 in2); + +/* +** \brief Compute a multiplication for uint16 arrays. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the multiplication of the two vectors = in1 .* in2. +*/ +EXTERN_OPERATIONS uint16 u16mulv(uint16 *in1, uint16 *in2, int size2); + +/* +** \brief Compute a multiplication element ways for int16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \param out : array that contains the multiplication = in1 .* in2. +*/ +EXTERN_OPERATIONS void i16mula(int16 *in1, int16 *in2, int size,int16 * out); + +/* +** \brief Compute a multiplication with int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return : in1 * in 2 = in1 .* in2. +*/ +EXTERN_OPERATIONS int16 i16muls(int16 in1, int16 in2); + +/* +** \brief Compute a multiplication for int16 arrays. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the multiplication of the two vectors = in1 .* in2. +*/ +EXTERN_OPERATIONS int16 i16mulv(int16 *in1, int16 *in2, int size2); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/operations/includes/subtraction.h b/src/c/operations/includes/subtraction.h index 8571a5de..798df2bf 100644 --- a/src/c/operations/includes/subtraction.h +++ b/src/c/operations/includes/subtraction.h @@ -16,6 +16,7 @@ #include "dynlib_operations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -107,6 +108,88 @@ EXTERN_OPERATIONS void zdiffa(doubleComplex *in1, int size1, doubleComplex *in2, int size2, doubleComplex *out); + +/* +** \brief Compute a subtraction with uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS uint8 u8diffs(uint8 in1, uint8 in2); + +/* +** \brief Compute a subtraction element wise for uint8. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the subtraction in1 + in2. +*/ +EXTERN_OPERATIONS void u8diffa(uint8 *in1, int size1, + uint8 *in2, int size2, + uint8 *out); + +/* +** \brief Compute a subtraction with int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS int8 i8diffs(int8 in1, int8 in2); + +/* +** \brief Compute a subtraction element wise for int8. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the subtraction in1 + in2. +*/ +EXTERN_OPERATIONS void i8diffa(int8 *in1, int size1, + int8 *in2, int size2, + int8 *out); + + +/* +** \brief Compute a subtraction with uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS uint16 u16diffs(uint16 in1, uint16 in2); + +/* +** \brief Compute a subtraction element wise for uint16. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the subtraction in1 + in2. +*/ +EXTERN_OPERATIONS void u16diffa(uint16 *in1, int size1, + uint16 *in2, int size2, + uint16 *out); + +/* +** \brief Compute a subtraction with int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS int16 i16diffs(int16 in1, int16 in2); + +/* +** \brief Compute a subtraction element wise for int16. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the subtraction in1 + in2. +*/ +EXTERN_OPERATIONS void i16diffa(int16 *in1, int size1, + int16 *in2, int size2, + int16 *out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/operations/interfaces/int_OpDotBackSlash.h b/src/c/operations/interfaces/int_OpDotBackSlash.h index 5ba1af3d..220da8db 100644 --- a/src/c/operations/interfaces/int_OpDotBackSlash.h +++ b/src/c/operations/interfaces/int_OpDotBackSlash.h @@ -25,6 +25,14 @@ #define z0z0OpDotBackSlashz0(in1,in2) zldivs(in1,in2) +#define u80u80OpDotBackSlashu80(in1,in2) u8ldivs(in1,in2) + +#define u160u160OpDotBackSlashu160(in1,in2) u16ldivs(in1,in2) + +#define i80i80OpDotBackSlashi80(in1,in2) i8ldivs(in1,in2) + +#define i160i160OpDotBackSlashi160(in1,in2) i16ldivs(in1,in2) + #define s0c0OpDotBackSlashc0(in1,in2) cldivs(FloatComplex(in1,0),in2) #define c0s0OpDotBackSlashc0(in1,in2) cldivs(in1,FloatComplex(in2,0)) @@ -48,6 +56,19 @@ #define z0z2OpDotBackSlashz2(in1,in2,size,out) {int i;\ for(i=0;i<size[0]*size[1];i++) out[i]= zldivs(in1,in2[i]);} +#define u80u82OpDotBackSlashu82(in1,in2,size,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= u8ldivs(in1,in2[i]);} + +#define u160u162OpDotBackSlashu162(in1,in2,size,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= u16ldivs(in1,in2[i]);} + +#define i80i82OpDotBackSlashi82(in1,in2,size,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= i8ldivs(in1,in2[i]);} + +#define i160i162OpDotBackSlashi162(in1,in2,size,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= i16ldivs(in1,in2[i]);} + + #define s0c2OpDotBackSlashc2(in1,in2,size,out) c0c2OpDotBackSlashc2(FloatComplex(in1,0),in2,size,out) #define d0z2OpDotBackSlashz2(in1,in2,size,out) z0z2OpDotBackSlashz2(DoubleComplex(in1,0),in2,size,out) @@ -73,6 +94,20 @@ #define z2z0OpDotBackSlashz2(in1,size,in2,out) {int i;\ for(i=0;i<size[0]*size[1];i++) out[i]= zldivs(in1[i],in2);} +#define u82u80OpDotBackSlashu82(in1,size,in2,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= u8ldivs(in1[i],in2);} + +#define u162u160OpDotBackSlashu162(in1,size,in2,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= u16ldivs(in1[i],in2);} + +#define i82i80OpDotBackSlashi82(in1,size,in2,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= i8ldivs(in1[i],in2);} + +#define i162i160OpDotBackSlashi162(in1,size,in2,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= i16ldivs(in1[i],in2);} + + + #define s2c0OpDotBackSlashc2(in1,size,in2,out) {int i;\ for(i=0;i<size[0]*size[1];i++) out[i]= cldivs(FloatComplex(in1[i],0),in2);} @@ -91,6 +126,15 @@ #define c2c2OpDotBackSlashc2(in1,size1,in2,size2,out) cldiva(in1,in2,size2[0]*size2[1],out) +#define u82u82OpDotBackSlashu82(in1,size1,in2,size2,out) u8ldiva(in1,in2,size2[0]*size2[1],out) + +#define u162u162OpDotBackSlashu162(in1,size1,in2,size2,out) u16ldiva(in1,in2,size2[0]*size2[1],out) + +#define i82i82OpDotBackSlashi82(in1,size1,in2,size2,out) i8ldiva(in1,in2,size2[0]*size2[1],out) + +#define i162i162OpDotBackSlashi162(in1,size1,in2,size2,out) i16ldiva(in1,in2,size2[0]*size2[1],out) + + #define c2s2OpDotBackSlashc2(in1,size1,in2,size2,out) {int i;\ for(i=0;i<size1[0]*size2[1];i++) out[i]= cldivs(in1[i],FloatComplex(in2[i], 0));} diff --git a/src/c/operations/interfaces/int_OpDotSlash.h b/src/c/operations/interfaces/int_OpDotSlash.h index a6c57051..54f0c3a2 100644 --- a/src/c/operations/interfaces/int_OpDotSlash.h +++ b/src/c/operations/interfaces/int_OpDotSlash.h @@ -25,6 +25,14 @@ #define z0z0OpDotSlashz0(in1,in2) zrdivs(in1,in2) +#define u80u80OpDotSlashu80(in1,in2) u8rdivs(in1,in2) + +#define u160u160OpDotSlashu160(in1,in2) u16rdivs(in1,in2) + +#define i80i80OpDotSlashi80(in1,in2) i8rdivs(in1,in2) + +#define i160i60OpDotSlashi60(in1,in2) i16divs(in1,in2) + #define s0c0OpDotSlashc0(in1,in2) crdivs(FloatComplex(in1,0),in2) #define c0s0OpDotSlashc0(in1,in2) crdivs(in1,FloatComplex(in2,0)) @@ -52,6 +60,19 @@ #define z0z2OpDotSlashz2(in1,in2,size,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=crdivs(in1,in2[i]);} +#define u80u82OpDotSlashu82(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define u160u162OpDotSlashu162(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define i80i82OpDotSlashi82(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define i160i162OpDotSlashi162(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + + #define s0c2OpDotSlashc2(in1,in2,size,out) c0c2OpDotSlashc2(FloatComplex(in1,0),in2,size,out) @@ -87,6 +108,19 @@ #define z2z0OpDotSlashz2(in1,size,in2,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=zrdivs(in1[i],in2);} +#define u82u80OpDotSlashu82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++ out[i]=in[i]/in2);} + +#define u162u160OpDotSlashu162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++ out[i]=in[i]/in2);} + +#define i82i80OpDotSlashi82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++ out[i]=in[i]/in2);} + +#define i162i160OpDotSlashi162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++ out[i]=in[i]/in2);} + + #define s2c0OpDotSlashc2(in1,size,in2,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=crdivs(FloatComplex(in1[i],0),in2);} @@ -113,6 +147,17 @@ #define z2z2OpDotSlashz2(in1,size1,in2,size2,out) zrdiva(in1,in2,size2[0]*size2[1],out) +#define u82u82OpDotSlashu82(in1,size1,in2,size2,out) u8rdiva(in1,in2,size2[0]*size2[1],out) + +#define u162u162OpDotSlashu162(in1,size1,in2,size2,out) u16rdiva(in1,in2,size2[0]*size2[1],out) + +#define i82i82OpDotSlashi82(in1,size1,in2,size2,out) i8rdiva(in1,in2,size2[0]*size2[1],out) + +#define i162i162OpDotSlashi162(in1,size1,in2,size2,out) i16rdiva(in1,in2,size2[0]*size2[1],out) + + + + #define c2s2OpDotSlashc2(in1,size1,in2,size2,out) {int i=0;\ for (i=0;i<size1[0]*size2[1];i++) out[i]=crdivs(in1[i],FloatComplex(in2[i],0));} diff --git a/src/c/operations/interfaces/int_OpDotStar.h b/src/c/operations/interfaces/int_OpDotStar.h index 22e09a92..4586e0c6 100644 --- a/src/c/operations/interfaces/int_OpDotStar.h +++ b/src/c/operations/interfaces/int_OpDotStar.h @@ -25,6 +25,14 @@ #define z0z0OpDotStarz0(in1,in2) zmuls(in1,in2) +#define u80u80OpDotStaru80(in1,in2) u8muls(in1,in2) + +#define u160u160OpDotStaru160(in1,in2) u16muls(in1,in2) + +#define i80i80OpDotStari80(in1,in2) i8muls(in1,in2) + +#define i160i60OpDotStari60(in1,in2) i16muls(in1,in2) + #define s0c0OpDotStarc0(in1,in2) cmuls(FloatComplex(in1,0),in2) #define c0s0OpDotStarc0(in1,in2) cmuls(in1,FloatComplex(in2,0)) @@ -48,6 +56,18 @@ #define z0z2OpDotStarz2(in1,in2,size,out) {int i=0;\ for(i=0;i<size[0]*size[1];i++) out[i]= zmuls(in1,in2[i]);} +#define u80u82OpDotStaru80(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = u8muls(in1,in2[i]);} + +#define u160u162OpDotStaru160(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = u16muls(in1,in2[i]);} + +#define i80i82OpDotStari80(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = i8muls(in1,in2[i]);} + +#define i160i162OpDotStari160(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = i16muls(in1,in2[i]);} + #define s0c2OpDotStarc2(in1,in2,size,out) c0c2OpDotStarc2(FloatComplex(in1,0),in2,size,out) #define d0z2OpDotStarz2(in1,in2,size,out) z0z2OpDotStarz2(DoubleComplex(in1,0),in2,size,out) @@ -73,6 +93,18 @@ #define z2z0OpDotStarz2(in1,size,in2,out) {int i=0;\ for(i=0;i<size[0]*size[1];i++) out[i]= zmuls(in1[i],in2);} +#define u82u80OpDotStaru82(in1,size,in2,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = u8muls(in[i],in2);} + +#define u162u160OpDotStaru162(in1,size,in2,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = u16muls(in[i],in2);} + +#define i82i80OpDotStari82(in1,size,in2,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = i8muls(in[i],in2);} + +#define i162i160OpDotStari162(in1,size,in2,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = i16muls(in[i],in2);} + #define s2c0OpDotStarc2(in1,size,in2,out) {int i=0;\ for(i=0;i<size[0]*size[1];i++) out[i]= cmuls(FloatComplex(in1[i],0),in2);} @@ -93,6 +125,14 @@ #define z2z2OpDotStarz2(in1,size1,in2,size2,out) zmula(in1,in2,size1[0]*size2[1],out) +#define u82u82OpDotStaru82(in1,size1,in2,size2,out) u8mula(in1,in2,size1[0]*size2[1],out) + +#define u162u162OpDotStaru162(in1,size1,in2,size2,out) u16mula(in1,in2,size1[0]*size2[1],out) + +#define i82i82OpDotStari82(in1,size1,in2,size2,out) i8mula(in1,in2,size1[0]*size2[1],out) + +#define i162i61OpDotStari162(in1,size1,in2,size2,out) i16mula(in1,in2,size1[0]*size2[1],out) + #define c2s2OpDotStarc2(in1,size1,in2,size2,out) {int i=0;\ for(i=0;i<size1[0]*size2[1];i++) out[i]= cmuls(in1[i],FloatComplex(in2[i],0));} diff --git a/src/c/operations/interfaces/int_OpLogAnd.h b/src/c/operations/interfaces/int_OpLogAnd.h index 460c81ca..50a31894 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 b15a8b6a..b693db65 100644 --- a/src/c/operations/interfaces/int_OpLogEq.h +++ b/src/c/operations/interfaces/int_OpLogEq.h @@ -14,17 +14,32 @@ #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))) #define c0s0OpLogEqs0(in1,in2) s0c0OpLogEqs0(in2,in1) #define z0d0OpLogEqd0(in1,in2) d0z0OpLogEqd0(in2,in1) +#define u80d0OpLogEqu80(in1,in2) (uint8) (in1 == (uint8)in2) +#define i80d0OpLogEqi80(in1,in2) (int8) (in1 == (int8)in2) +#define u160d0OpLogEqu160(in1,in2) (uint16) (in1 == (uint16)in2) +#define i160d0OpLogEqi160(in1,in2) (int16) (in1 == (int16)in2) + +#define d0u80OpLogEqu80(in1,in2) (uint8) ((uint8)in1 == in2) +#define d0i80OpLogEqi80(in1,in2) (int8) ((int8)in1 == in2) +#define d0u160OpLogEqu160(in1,in2) (uint16) ((uint16)in1 == in2) +#define d0i160OpLogEqi160(in1,in2) (int16) ((int16)in1 == in2) #define s2s0OpLogEqs2(in1,size,in2,out) {int i;\ @@ -51,8 +66,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 +90,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 +124,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 0ce1ad81..edbdc071 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 161b654f..38c76cfb 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 ebb09c7b..8dbd1aac 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 2c5d8639..8974b156 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 238ef483..56cafefa 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_OpLogNot.h b/src/c/operations/interfaces/int_OpLogNot.h index 6184265c..852cd1c7 100644 --- a/src/c/operations/interfaces/int_OpLogNot.h +++ b/src/c/operations/interfaces/int_OpLogNot.h @@ -23,6 +23,14 @@ #define z0OpLogNotz0(in) (zreals(in)==0) ? DoubleComplex(1,0) : DoubleComplex(0,0) +#define u8OpLogNotu80(in) (in==0) ? (uint8)1 : (uint8)0 + +#define i8OpLogNoti80(in) (in==0) ? (int8)1 : (int8)0 + +#define u16OpLogNotu160(in) (in==0) ? (uint16)1 : (uint16)0 + +#define i16OpLogNoti160(in) (in==0) ? (int16)1 : (int16)0 + #define s2OpLogNots2(in,size,out) {int i;\ for (i=0;i<size[0]*size[1];i++) out[i]=s0OpLogNots0(in[i]);\ } @@ -39,4 +47,21 @@ for (i=0;i<size[0]*size[1];i++) out[i]=z0OpLogNotz0(in[i]);\ } +#define u82OpLogNotu82(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u80OpLogNotu80(in[i]);\ + } + +#define i82OpLogNoti82(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i80OpLogNoti80(in[i]);\ + } + +#define u162OpLogNotu162(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u160OpLogNoti160(in[i]);\ + } + +#define i162OpLogNoti162(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i160OpLogNotu160(in[i]);\ + } + + #endif /* !__INT_OPLOGNOT_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogOr.h b/src/c/operations/interfaces/int_OpLogOr.h index b5d55fba..c7acb51d 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,54 +79,93 @@ #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 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.2f || in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.0 || in2[i] != 0.0);} #define d0d2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.2 || in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.0 || in2[i] != 0.0);} #define c0c2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.2f || cimags(in1) != 0.2f) || (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.0 || cimags(in1) != 0.0) || (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define s0c2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.2f && (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.0 && (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define c0s2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.2f || cimags(in1) != 0.2f) && in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.0 || cimags(in1) != 0.0) && in2[i] != 0.0);} #define z0z2OpLogOrd2(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) && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define d0z2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.2 && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.0 && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #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);} + 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 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 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.2f || in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.0 || in2[i] != 0.0);} #define d2d2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.2 || in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.0 || in2[i] != 0.0);} #define c2c2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.2f || cimags(in1[i]) != 0.2f) || (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.0 || cimags(in1[i]) != 0.0) || (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define s2c2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.2f && (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.0 && (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define c2s2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.2f || cimags(in1[i]) != 0.2f) && in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.0 || cimags(in1[i]) != 0.0) && in2[i] != 0.0);} #define z2z2OpLogOrd2(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) && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define d2z2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.2 && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.0 && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #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);} + 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 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/operations/interfaces/int_OpMinus.h b/src/c/operations/interfaces/int_OpMinus.h index ac27ddb6..2ea8a521 100644 --- a/src/c/operations/interfaces/int_OpMinus.h +++ b/src/c/operations/interfaces/int_OpMinus.h @@ -25,6 +25,14 @@ #define z0OpMinusz0(in) DoubleComplex(-zreals(in), -zimags(in)) +#define u80OpMinusu80(in) -(int8)in + +#define i80OpMinusi80(in) -in + +#define u160OpMinusu160(in) -(int16)in + +#define i160OpMinusi160(in) -in + /* - Matrix */ #define s2OpMinuss2(in, size, out) {int i=0; \ @@ -43,6 +51,25 @@ for (i=0;i<size[0]*size[1];i++) out[i] = DoubleComplex(-zreals(in[i]), -zimags(in[i])); \ } +#define u82OpMinusu82(in, size, out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i] = -(int8)in[i]; \ + } + + +#define i82OpMinusi82(in, size, out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i] = -in[i]; \ + } + + +#define u162OpMinusu162(in, size, out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i] = -(int16)in[i]; \ + } + + +#define i162OpMinui162(in, size, out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i] = -(int16)in[i]; \ + } + /* Scalar - Scalar */ @@ -62,6 +89,14 @@ #define z0d0OpMinusz0(in1,in2) zdiffs(in1,DoubleComplex(in2,0)) +#define u80u80OpMinusu80(in1,in2) u8diffs(in1,in2) + +#define i80i80OpMinusi80(in1,in2) i8diffs(in1,in2) + +#define u160u160OpMinusu160(in1,in2) u16diffs(in1,in2) + +#define i160i160OpMinusi160(in1,in2) i16diffs(in1,in2) + /* Matrix - Scalar */ @@ -99,6 +134,25 @@ } +#define u82u80OpMinusu82(in1,size,in2,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]-in2; \ + } + + +#define i82i80OpMinusi82(in1,size,in2,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]-in2; \ + } + + +#define u162u160OpMinusu162(in1,size,in2,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]-in2; \ + } + + +#define i162i160OpMinusi162(in1,size,in2,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]-in2; \ + } + /* Scalar - Matrix */ @@ -136,6 +190,22 @@ } +#define u80u82OpMinusu82(in1,in2,size,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1-in2[i]; \ + } + + +#define i80i82OpMinusi82(in1,in2,size,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1-in2[i]; \ + } + +#define u160u162OpMinusu162(in1,in2,size,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1-in2[i]; \ + } + +#define i160i162OpMinusi162(in1,in2,size,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1-in2[i]; \ + } /* Matrix - Matrix */ @@ -167,7 +237,12 @@ for (i=0;i<size1[0]*size2[1];i++) out[i]=zdiffs(in1[i],DoubleComplex(in2[i],0)); \ } +#define u82u82OpMinusu82(in1,size1,in2,size2,out) u8diffa(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) + +#define i82i82OpMinusi82(in1,size1,in2,size2,out) i8diffa(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) +#define u162u162OpMinusu162(in1,size1,in2,size2,out) u16diffa(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) +#define i162i162OpMinusi162(in1,size1,in2,size2,out) i16diffa(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) #endif /* !__INT_OPMINUS_H__ */ diff --git a/src/c/operations/interfaces/int_OpPlus.h b/src/c/operations/interfaces/int_OpPlus.h index cb86d815..a5731d43 100644 --- a/src/c/operations/interfaces/int_OpPlus.h +++ b/src/c/operations/interfaces/int_OpPlus.h @@ -34,7 +34,13 @@ #define z0d0OpPlusz0(in1,in2) zadds(in1,DoubleComplex(in2,0)) +#define u80u80OpPlusu80(in1,in2) u8adds(in1,in2) +#define i80i80OpPlusi80(in1,in2) i8adds(in1,in2) + +#define u160u160OpPlusu160(in1,in2) u16adds(in1,in2) + +#define i160i160OpPlusi160(in1,in2) i16adds(in1,in2) /* Matrix + Scalar */ @@ -68,6 +74,21 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zadds(DoubleComplex(in1[i],0),in2);\ } +#define u82u80OpPlusu82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]+in2;\ + } + +#define i82i80OpPlusi82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]+in2;\ + } + +#define u162u160OpPlusu162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]+in2;\ + } + +#define i162i160OpPlusi162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]+in2;\ + } /* Scalar + Matrix */ @@ -101,7 +122,21 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zadds(in1,DoubleComplex(in2[i],0));\ } +#define u80u82OpPlusu82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1+in2[i];\ + } + +#define i80i82OpPlusi82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1+in2[i];\ + } + +#define u160u162OpPlusu162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1+in2[i];\ + } +#define i160i162OpPlusi162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1+in2[i];\ + } /* Matrix + Matrix */ @@ -132,7 +167,13 @@ for (i=0;i<size1[0]*size2[1];i++) out[i]=zadds(in1[i],DoubleComplex(in2[i],0));\ } +#define u82u82OpPlusu82(in1,size1,in2,size2,out) u8adda(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) + +#define i82i82OpPlusi82(in1,size1,in2,size2,out) i8adda(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) + +#define u162u162OpPlusu162(in1,size1,in2,size2,out) u16adda(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) +#define i162i162OpPlusi162(in1,size1,in2,size2,out) i16adda(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) /* Strings */ /* RNU: size1[1]-1 -> "-1" because '\0' of the first string must be removed. */ #define g2g2OpPlusg2(in1,size1,in2,size2,out) {int i = 0, j = 0; \ diff --git a/src/c/operations/interfaces/int_OpSlash.h b/src/c/operations/interfaces/int_OpSlash.h index fd8dda28..635fe2bf 100644 --- a/src/c/operations/interfaces/int_OpSlash.h +++ b/src/c/operations/interfaces/int_OpSlash.h @@ -33,6 +33,13 @@ #define z0d0OpSlashz0(in1,in2) zrdivs(in1,DoubleComplex(in2,0)) +#define u80u80OpSlashu80(in1,in2) u8rdivs(in1,in2) + +#define i80i80OpSlashi80(in1,in2) i8rdivs(in1,in2) + +#define u160u160OpSlashu160(in1,in2) u16rdivs(in1,in2) + +#define i160i160OpSlashi160(in1,in2) i16rdivs(in1,in2) /* Scalar / Matrix */ @@ -76,6 +83,17 @@ dinverma(in2,temp,size[0]);\ for (i=0;i<size[0]*size[1];i++) out[i]=zmuls(in1,DoubleComplex(temp[i],0));} +#define u80u82OpSlashu82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define i80i82OpSlashi82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define u160u162OpSlashu162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define i160i162OpSlashi162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} /* Matrix / Scalar */ @@ -110,8 +128,17 @@ #define z2d0OpSlashz2(in1,size,in2,out) z2z0OpSlashz2(in1,size,DoubleComplex(in2,0),out) +#define u82u80OpSlashu82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]/in2;} +#define i82i80OpSlashi82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]/in2;} +#define u162u160OpSlashu162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]/in2;} + +#define i162i160OpSlashi162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]/in2;} /* Matrix / Matrix */ diff --git a/src/c/operations/interfaces/int_OpStar.h b/src/c/operations/interfaces/int_OpStar.h index 52ff221c..78697b3e 100644 --- a/src/c/operations/interfaces/int_OpStar.h +++ b/src/c/operations/interfaces/int_OpStar.h @@ -33,9 +33,47 @@ #define z0d0OpStarz0(in1,in2) zmuls(in1,DoubleComplex(in2,0)) +#define u80u80OpStaru80(in1,in2) u8muls(in1, in2) -/* Scalar * Matrix */ +#define u80u80OpStaru160(in1,in2) (uint16)(in1 * in2) + +#define u80i80OpStari80(in1,in2) (int8)(in1 * in2) + +#define u80i80OpStari160(in1,in2) (int16)(in1 * in2) + +#define u80u160OpStaru160(in1,in2) (uint16)(in1 * in2) + +#define u80i160OpStari160(in1,in2) (int16)(in1 * in2) + +#define i80u80OpStari80(in1,in2) (int8)(in1 * in2) + +#define i80u80OpStari160(in1,in2) (int16)(in1 * in2) + +#define i80i80OpStari80(in1,in2) (int8)(in1 , in2) + +#define i80i80OpStari160(in1,in2) (int16)(in1 * in2) + +#define i80u160OpStari160(in1,in2) (int16)(in1 * in2) + +#define i80i160OpStari160(in1,in2) (int16)(in1 * in2) +#define u160u80OpStaru160(in1,in2) (uint16)(in1 * in2) + +#define u160i80OpStari160(in1,in2) (int16)(in1 * in2) + +#define u160u160OpStaru160(in1,in2) u16muls(in1 , in2) + +#define u160i160OpStari160(in1,in2) (int16)(in1 * in2) + +#define i160u80OpStari160(in1,in2) (int16)(in1 * in2) + +#define i160i80OpStari160(in1,in2) (int16)(in1 * in2) + +#define i160u160OpStari160(in1,in2) (int16)(in1 * in2) + +#define i160i160OpStari160(in1,in2) i16muls(in1 , in2) + +/* Scalar * Matrix */ #define s0s2OpStars2(in1,in2,size,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=in1*in2[i];} @@ -65,6 +103,18 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zmuls(in1,DoubleComplex(in2[i],0));} +#define u80u82OpStaru82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1*(uint8)in2[i];} + +#define i80i82OpStari82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1*in2[i];} + +#define u160u162OpStaru162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1*in2[i];} + +#define i160i162OpStari162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1*in2[i];} + /* Matrix * Scalar */ @@ -96,6 +146,20 @@ #define z2d0OpStarz2(in1,size,in2,out) z2z0OpStarz2(in1,size,DoubleComplex(in2,0),out) + +#define u82u80OpStaru82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]*in2;} + +#define i82i80OpStari82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]*in2;} + +#define u162u160OpStaru162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]*in2;} + +#define i162i160OpStari162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]*in2;} + + /* Matrix * Matrix */ #define s2s2OpStars2(in1,size1,in2,size2,out) smulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) @@ -148,4 +212,12 @@ #define z2z2OpStarz0(in1, size1, in2, size2) zmulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) +#define u82u82OpStaru80(in1, size1, in2, size2) u8mulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) + +#define i82i82OpStari80(in1, size1, in2, size2) i8mulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) + +#define u162u162OpStaru160(in1, size1, in2, size2) u16mulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) + +#define i162i162OpStari160(in1, size1, in2, size2) i16mulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) + #endif /* !__INT_OPSTAR_H__ */ diff --git a/src/c/operations/multiplication/dmula.c b/src/c/operations/multiplication/dmula.c index 976faacf..77c204a7 100644 --- a/src/c/operations/multiplication/dmula.c +++ b/src/c/operations/multiplication/dmula.c @@ -15,7 +15,8 @@ void dmula(double* in1, double* in2, int size, double* out){ int i=0; - for (i=0;i<size;i++){ + for (i=0;i<size;i++) + { out[i]=dmuls(in1[i],in2[i]); } } diff --git a/src/c/operations/multiplication/dmuls.c b/src/c/operations/multiplication/dmuls.c index 09e7fdf5..ac21ace0 100644 --- a/src/c/operations/multiplication/dmuls.c +++ b/src/c/operations/multiplication/dmuls.c @@ -13,6 +13,7 @@ #include "multiplication.h" -double dmuls(double in1, double in2){ +double dmuls(double in1, double in2) +{ return in1*in2; } diff --git a/src/c/operations/multiplication/i16mula.c b/src/c/operations/multiplication/i16mula.c new file mode 100644 index 00000000..bffa107e --- /dev/null +++ b/src/c/operations/multiplication/i16mula.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +void i16mula(int16* in1, int16* in2, int size, int16* out){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i16muls(in1[i],in2[i]); + } +} diff --git a/src/c/operations/multiplication/i16muls.c b/src/c/operations/multiplication/i16muls.c new file mode 100644 index 00000000..4aaa5d11 --- /dev/null +++ b/src/c/operations/multiplication/i16muls.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" +#include "types.h" + +int16 i16muls(int16 in1, int16 in2){ + return in1*in2; +} diff --git a/src/c/operations/multiplication/i16mulv.c b/src/c/operations/multiplication/i16mulv.c new file mode 100644 index 00000000..3f3cc8d1 --- /dev/null +++ b/src/c/operations/multiplication/i16mulv.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +int16 i16mulv(int16* in1, int16* in2, int size) +{ + int16 out = 0; + int i = 0; + + for (i = 0 ; i < size ; ++i) + { + out += i16muls(in1[i], in2[i]); + } + + return out; +} diff --git a/src/c/operations/multiplication/i8mula.c b/src/c/operations/multiplication/i8mula.c new file mode 100644 index 00000000..c5c6114d --- /dev/null +++ b/src/c/operations/multiplication/i8mula.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +void i8mula(int8* in1, int8* in2, int size, int8* out){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i8muls(in1[i],in2[i]); + } +} diff --git a/src/c/operations/multiplication/i8muls.c b/src/c/operations/multiplication/i8muls.c new file mode 100644 index 00000000..d6566208 --- /dev/null +++ b/src/c/operations/multiplication/i8muls.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" +#include "types.h" + +int8 i8muls(int8 in1, int8 in2){ + return in1*in2; +} diff --git a/src/c/operations/multiplication/i8mulv.c b/src/c/operations/multiplication/i8mulv.c new file mode 100644 index 00000000..6dc1ec4e --- /dev/null +++ b/src/c/operations/multiplication/i8mulv.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +int8 i8mulv(int8* in1, int8* in2, int size) +{ + int8 out = 0; + int i = 0; + + for (i = 0 ; i < size ; ++i) + { + out += i8muls(in1[i], in2[i]); + } + + return out; +} diff --git a/src/c/operations/multiplication/u16mula.c b/src/c/operations/multiplication/u16mula.c new file mode 100644 index 00000000..5be6e64e --- /dev/null +++ b/src/c/operations/multiplication/u16mula.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +void u16mula(uint16* in1, uint16* in2, int size, uint16* out){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u16muls(in1[i],in2[i]); + } +} diff --git a/src/c/operations/multiplication/u16muls.c b/src/c/operations/multiplication/u16muls.c new file mode 100644 index 00000000..10380c0d --- /dev/null +++ b/src/c/operations/multiplication/u16muls.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" +#include "types.h" + +uint16 u16muls(uint16 in1, uint16 in2){ + return in1*in2; +} diff --git a/src/c/operations/multiplication/u16mulv.c b/src/c/operations/multiplication/u16mulv.c new file mode 100644 index 00000000..5cd9805c --- /dev/null +++ b/src/c/operations/multiplication/u16mulv.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +uint16 u16mulv(uint16* in1, uint16* in2, int size) +{ + uint16 out = 0; + int i = 0; + + for (i = 0 ; i < size ; ++i) + { + out += u16muls(in1[i], in2[i]); + } + + return out; +} diff --git a/src/c/operations/multiplication/u8mula.c b/src/c/operations/multiplication/u8mula.c new file mode 100644 index 00000000..7ff2dd0b --- /dev/null +++ b/src/c/operations/multiplication/u8mula.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +void u8mula(uint8* in1, uint8* in2, int size, uint8* out){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u8muls(in1[i],in2[i]); + } +} diff --git a/src/c/operations/multiplication/u8muls.c b/src/c/operations/multiplication/u8muls.c new file mode 100644 index 00000000..7acf5b58 --- /dev/null +++ b/src/c/operations/multiplication/u8muls.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" +#include "types.h" + +uint8 u8muls(uint8 in1, uint8 in2){ + return in1*in2; +} diff --git a/src/c/operations/multiplication/u8mulv.c b/src/c/operations/multiplication/u8mulv.c new file mode 100644 index 00000000..9ae063e8 --- /dev/null +++ b/src/c/operations/multiplication/u8mulv.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "multiplication.h" + +uint8 u8mulv(uint8* in1, uint8* in2, int size) +{ + uint8 out = 0; + int i = 0; + + for (i = 0 ; i < size ; ++i) + { + out += u8muls(in1[i], in2[i]); + } + + return out; +} diff --git a/src/c/operations/subtraction/i16diffa.c b/src/c/operations/subtraction/i16diffa.c new file mode 100644 index 00000000..5a3c78c7 --- /dev/null +++ b/src/c/operations/subtraction/i16diffa.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +void i16diffa(int16* in1, int size1, int16* in2, int size2, int16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i16diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/i16diffs.c b/src/c/operations/subtraction/i16diffs.c new file mode 100644 index 00000000..c73bab0b --- /dev/null +++ b/src/c/operations/subtraction/i16diffs.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +int16 i16diffs(int16 in1, int16 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/i8diffa.c b/src/c/operations/subtraction/i8diffa.c new file mode 100644 index 00000000..8eae7597 --- /dev/null +++ b/src/c/operations/subtraction/i8diffa.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +void i8diffa(int8* in1, int size1, int8* in2, int size2, int8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i8diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/i8diffs.c b/src/c/operations/subtraction/i8diffs.c new file mode 100644 index 00000000..88eaf4d1 --- /dev/null +++ b/src/c/operations/subtraction/i8diffs.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +int8 i8diffs(int8 in1, int8 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/u16diffa.c b/src/c/operations/subtraction/u16diffa.c new file mode 100644 index 00000000..e9a30499 --- /dev/null +++ b/src/c/operations/subtraction/u16diffa.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +void u16diffa(uint16* in1, int size1, uint16* in2, int size2, uint16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u16diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/u16diffs.c b/src/c/operations/subtraction/u16diffs.c new file mode 100644 index 00000000..baf4e078 --- /dev/null +++ b/src/c/operations/subtraction/u16diffs.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +uint16 u16diffs(uint16 in1, uint16 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/u8diffa.c b/src/c/operations/subtraction/u8diffa.c new file mode 100644 index 00000000..c1512e91 --- /dev/null +++ b/src/c/operations/subtraction/u8diffa.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +void u8diffa(uint8* in1, int size1, uint8* in2, int size2, uint8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u8diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/u8diffs.c b/src/c/operations/subtraction/u8diffs.c new file mode 100644 index 00000000..f71192ac --- /dev/null +++ b/src/c/operations/subtraction/u8diffs.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +uint8 u8diffs(uint8 in1, uint8 in2) +{ + return (in1 - in2); +} |