From aba32804a6cbd6fb16e13e86364e643022a2941a Mon Sep 17 00:00:00 2001 From: Siddhesh Wani Date: Thu, 6 Aug 2015 01:10:39 +0530 Subject: Multiplication tested for new data types --- src/c/elementaryFunctions/interfaces/int_int16.h | 8 +-- src/c/elementaryFunctions/interfaces/int_int8.h | 8 +-- src/c/elementaryFunctions/interfaces/int_uint16.h | 8 +-- src/c/operations/division/i16ldivs.c | 19 ++++++ src/c/operations/division/i16rdivs.c | 19 ++++++ src/c/operations/division/i8ldivs.c | 19 ++++++ src/c/operations/division/i8rdivs.c | 19 ++++++ src/c/operations/division/u16ldivs.c | 19 ++++++ src/c/operations/division/u16rdivs.c | 19 ++++++ src/c/operations/division/u8ldivs.c | 19 ++++++ src/c/operations/division/u8rdivs.c | 19 ++++++ src/c/operations/includes/division.h | 67 ++++++++++++++++++++ src/c/operations/includes/multiplication.h | 70 +++++++++++++++++++++ src/c/operations/interfaces/int_OpMinus.h | 10 ++- src/c/operations/interfaces/int_OpPlus.h | 2 +- src/c/operations/interfaces/int_OpSlash.h | 27 ++++++++ src/c/operations/interfaces/int_OpStar.h | 75 ++++++++++++++++------- src/c/operations/multiplication/i16muls.c | 2 +- src/c/operations/multiplication/i16mulv.c | 6 +- src/c/operations/multiplication/i8muls.c | 2 +- src/c/operations/multiplication/i8mulv.c | 6 +- src/c/operations/multiplication/u16muls.c | 2 +- src/c/operations/multiplication/u16mulv.c | 6 +- src/c/operations/multiplication/u8muls.c | 2 +- src/c/operations/multiplication/u8mulv.c | 6 +- 25 files changed, 407 insertions(+), 52 deletions(-) create mode 100644 src/c/operations/division/i16ldivs.c create mode 100644 src/c/operations/division/i16rdivs.c create mode 100644 src/c/operations/division/i8ldivs.c create mode 100644 src/c/operations/division/i8rdivs.c create mode 100644 src/c/operations/division/u16ldivs.c create mode 100644 src/c/operations/division/u16rdivs.c create mode 100644 src/c/operations/division/u8ldivs.c create mode 100644 src/c/operations/division/u8rdivs.c (limited to 'src') diff --git a/src/c/elementaryFunctions/interfaces/int_int16.h b/src/c/elementaryFunctions/interfaces/int_int16.h index 759cb971..353890d5 100644 --- a/src/c/elementaryFunctions/interfaces/int_int16.h +++ b/src/c/elementaryFunctions/interfaces/int_int16.h @@ -15,12 +15,12 @@ #ifndef __INT_INT16_H__ #define __INT_INT16_H__ -#define s0int16u80(in) sint16s(in) +#define s0int16i160(in) sint16s(in) -#define d0int16u80(in) dint16s(in) +#define d0int16i160(in) dint16s(in) -#define s2int16u82(in,size,out) sint16a(in, size[0]*size[1], out) +#define s2int16i162(in,size,out) sint16a(in, size[0]*size[1], out) -#define d2int16u82(in,size,out) dint16a(in, size[0]*size[1], out) +#define d2int16i162(in,size,out) dint16a(in, size[0]*size[1], out) #endif /* !__INT_INT8_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_int8.h b/src/c/elementaryFunctions/interfaces/int_int8.h index 5cf129eb..0f6dde24 100644 --- a/src/c/elementaryFunctions/interfaces/int_int8.h +++ b/src/c/elementaryFunctions/interfaces/int_int8.h @@ -15,12 +15,12 @@ #ifndef __INT_INT8_H__ #define __INT_INT8_H__ -#define s0int8u80(in) sint8s(in) +#define s0int8i80(in) sint8s(in) -#define d0int8u80(in) dint8s(in) +#define d0int8i80(in) dint8s(in) -#define s2int8u82(in,size,out) sint8a(in, size[0]*size[1], out) +#define s2int8i82(in,size,out) sint8a(in, size[0]*size[1], out) -#define d2int8u82(in,size,out) dint8a(in, size[0]*size[1], out) +#define d2int8i82(in,size,out) dint8a(in, size[0]*size[1], out) #endif /* !__INT_INT8_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_uint16.h b/src/c/elementaryFunctions/interfaces/int_uint16.h index 0d558b30..7d362437 100644 --- a/src/c/elementaryFunctions/interfaces/int_uint16.h +++ b/src/c/elementaryFunctions/interfaces/int_uint16.h @@ -15,12 +15,12 @@ #ifndef __INT_UINT16_H__ #define __INT_UINT16_H__ -#define s0uint16u80(in) suint16s(in) +#define s0uint16u160(in) suint16s(in) -#define d0uint16u80(in) duint16s(in) +#define d0uint16u160(in) duint16s(in) -#define s2uint16u82(in,size,out) suint16a(in, size[0]*size[1], out) +#define s2uint16u162(in,size,out) suint16a(in, size[0]*size[1], out) -#define d2uint16u82(in,size,out) duint16a(in, size[0]*size[1], out) +#define d2uint16u162(in,size,out) duint16a(in, size[0]*size[1], out) #endif /* !__INT_UINT8_H__ */ diff --git a/src/c/operations/division/i16ldivs.c b/src/c/operations/division/i16ldivs.c new file mode 100644 index 00000000..b470b16a --- /dev/null +++ b/src/c/operations/division/i16ldivs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "division.h" + + +int16 i16ldivs (int16 in1, int16 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/i16rdivs.c b/src/c/operations/division/i16rdivs.c new file mode 100644 index 00000000..e4d54823 --- /dev/null +++ b/src/c/operations/division/i16rdivs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "division.h" + + +int16 i16rdivs (int16 in1, int16 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/i8ldivs.c b/src/c/operations/division/i8ldivs.c new file mode 100644 index 00000000..6bf0d266 --- /dev/null +++ b/src/c/operations/division/i8ldivs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "division.h" + + +int8 i8ldivs (int8 in1, int8 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/i8rdivs.c b/src/c/operations/division/i8rdivs.c new file mode 100644 index 00000000..db8062fa --- /dev/null +++ b/src/c/operations/division/i8rdivs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "division.h" + + +int8 i8rdivs (int8 in1, int8 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/u16ldivs.c b/src/c/operations/division/u16ldivs.c new file mode 100644 index 00000000..5383ebf4 --- /dev/null +++ b/src/c/operations/division/u16ldivs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "division.h" + + +uint16 u16ldivs (uint16 in1, uint16 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/u16rdivs.c b/src/c/operations/division/u16rdivs.c new file mode 100644 index 00000000..68b998fd --- /dev/null +++ b/src/c/operations/division/u16rdivs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "division.h" + + +uint16 u16rdivs (uint16 in1, uint16 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/u8ldivs.c b/src/c/operations/division/u8ldivs.c new file mode 100644 index 00000000..0694d5f0 --- /dev/null +++ b/src/c/operations/division/u8ldivs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "division.h" + + +uint8 u8ldivs (uint8 in1, uint8 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/u8rdivs.c b/src/c/operations/division/u8rdivs.c new file mode 100644 index 00000000..e6364a86 --- /dev/null +++ b/src/c/operations/division/u8rdivs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "division.h" + + +uint8 u8rdivs (uint8 in1, uint8 in2){ + return in1/in2; +} diff --git a/src/c/operations/includes/division.h b/src/c/operations/includes/division.h index df4c5d2a..eedf4a3f 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,38 @@ 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 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 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); + /* ** LEFT DIVISION */ @@ -173,6 +206,40 @@ EXTERN_OPERATIONS doubleComplex zldivs (doubleComplex in1, doubleComplex in2); */ EXTERN_OPERATIONS void zldiva(doubleComplex* in1, doubleComplex* in2, int size, doubleComplex* 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 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 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 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..8b08d6df 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,75 @@ EXTERN_OPERATIONS doubleComplex zmulzdv(doubleComplex *in1, double *in2, int siz EXTERN_OPERATIONS doubleComplex zmuldzv(double *in1, doubleComplex *in2, int size2); +/* +** \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 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 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 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/interfaces/int_OpMinus.h b/src/c/operations/interfaces/int_OpMinus.h index b96328ed..2ea8a521 100644 --- a/src/c/operations/interfaces/int_OpMinus.h +++ b/src/c/operations/interfaces/int_OpMinus.h @@ -56,7 +56,7 @@ } -#define u82OpMinusu82(in, size, out) {int i=0; \ +#define i82OpMinusi82(in, size, out) {int i=0; \ for (i=0;i "-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