diff options
Diffstat (limited to '2.3-1/src')
6 files changed, 243 insertions, 0 deletions
diff --git a/2.3-1/src/c/matrixOperations/includes/matrixMultiplication.h b/2.3-1/src/c/matrixOperations/includes/matrixMultiplication.h index 228dd163..c2235c8b 100644 --- a/2.3-1/src/c/matrixOperations/includes/matrixMultiplication.h +++ b/2.3-1/src/c/matrixOperations/includes/matrixMultiplication.h @@ -16,6 +16,7 @@ #include "dynlib_matrixoperations.h" #include "multiplication.h" #include "addition.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -84,6 +85,64 @@ EXTERN_MATOPS void zmulma(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, int lines2, int columns2, doubleComplex *out); +/* +** \brief Compute a multiplication for uint8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void u8mulma(uint8 *in1, int lines1, int columns1, + uint8 *in2, int lines2, int columns2, + uint8 *out); + +/* +** \brief Compute a multiplication for uint16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void u16mulma(uint16 *in1, int lines1, int columns1, + uint16 *in2, int lines2, int columns2, + uint16 *out); + +/* +** \brief Compute a multiplication for int8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void i8mulma(int8 *in1, int lines1, int columns1, + int8 *in2, int lines2, int columns2, + int8 *out); + +/* +** \brief Compute a multiplication for int16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void i16mulma(int16 *in1, int lines1, int columns1, + int16 *in2, int lines2, int columns2, + int16 *out); + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_OpStar.h b/2.3-1/src/c/matrixOperations/interfaces/int_OpStar.h index 400918a4..f922b319 100644 --- a/2.3-1/src/c/matrixOperations/interfaces/int_OpStar.h +++ b/2.3-1/src/c/matrixOperations/interfaces/int_OpStar.h @@ -23,6 +23,14 @@ #define c2c2OpStarc2(in1,size1,in2,size2,out) cmulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define u82u82OpStaru82(in1,size1,in2,size2,out) u8mulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + +#define u162u162OpStaru162(in1,size1,in2,size2,out) u16mulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + +#define i82i82OpStari82(in1,size1,in2,size2,out) i8mulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + +#define i162i162OpStari162(in1,size1,in2,size2,out) i16mulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + #define c2s2OpStarc2(in1,size1,in2,size2,out) cmulma(in1,size1[0],size1[1],FloatComplexMatrix(in2,0,size2[0]*size2[1]),size2[0],size2[1],out) #define s2c2OpStarc2(in1,size1,in2,size2,out) cmulma(FloatComplexMatrix(in1,0,size1[0]*size1[1]),size1[0],size1[1],in2,size2[0],size2[1],out) diff --git a/2.3-1/src/c/matrixOperations/multiplication/i16mulma.c b/2.3-1/src/c/matrixOperations/multiplication/i16mulma.c new file mode 100644 index 00000000..ee1268a4 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/multiplication/i16mulma.c @@ -0,0 +1,44 @@ +/*SCilab2C FOSSEE IIT Bombay*/ + +/* +** \brief Compute a multiplication for int16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ + +// dgemm function of lapack library does not support uint8,uint16,int8 and int16 datatype so removed + +#include "matrixMultiplication.h" + +void i16mulma(int16 *in1,int lines1,int columns1, + int16 *in2,int lines2,int columns2, + int16 *out) +{ + + /* Do Not Use Any BLAS Function*/ + int i = 0; + int k = 0; + int16 accu = 0; + + /* How to convert 2 index matrixes to one. + ** #define in1(a,b) in1[a+b*lines1] + ** #define in2(c,d) in2[c+d*lines2] + */ + for(i=0;i < lines1 * columns2; ++i) + { + accu = 0; + for(k=0;k < columns1; ++k) + { + accu += in1[i % lines1 + k * lines1] * in2[k + (i / lines1) * lines2]; + + } + out[i] = accu; + + } + +} diff --git a/2.3-1/src/c/matrixOperations/multiplication/i8mulma.c b/2.3-1/src/c/matrixOperations/multiplication/i8mulma.c new file mode 100644 index 00000000..0efe797e --- /dev/null +++ b/2.3-1/src/c/matrixOperations/multiplication/i8mulma.c @@ -0,0 +1,44 @@ +/*SCilab2C FOSSEE IIT Bombay*/ + +/* +** \brief Compute a multiplication for int8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ + +// dgemm function of lapack library does not support uint8,uint16,int8 and int16 datatype so removed + +#include "matrixMultiplication.h" + +void i8mulma(int8 *in1,int lines1,int columns1, + int8 *in2,int lines2,int columns2, + int8 *out) +{ + + /* Do Not Use Any BLAS Function*/ + int i = 0; + int k = 0; + int8 accu = 0; + + /* How to convert 2 index matrixes to one. + ** #define in1(a,b) in1[a+b*lines1] + ** #define in2(c,d) in2[c+d*lines2] + */ + for(i=0;i < lines1 * columns2; ++i) + { + accu = 0; + for(k=0;k < columns1; ++k) + { + accu += in1[i % lines1 + k * lines1] * in2[k + (i / lines1) * lines2]; + + } + out[i] = accu; + + } + +} diff --git a/2.3-1/src/c/matrixOperations/multiplication/u16mulma.c b/2.3-1/src/c/matrixOperations/multiplication/u16mulma.c new file mode 100644 index 00000000..a36c57c7 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/multiplication/u16mulma.c @@ -0,0 +1,44 @@ +/*SCilab2C FOSSEE IIT Bombay*/ + +/* +** \brief Compute a multiplication for uint16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ + +// dgemm function of lapack library does not support uint8,uint16,int8 and int16 datatype so removed + +#include "matrixMultiplication.h" + +void u16mulma(uint16 *in1,int lines1,int columns1, + uint16 *in2,int lines2,int columns2, + uint16 *out) +{ + + /* Do Not Use Any BLAS Function*/ + int i = 0; + int k = 0; + uint16 accu = 0; + + /* How to convert 2 index matrixes to one. + ** #define in1(a,b) in1[a+b*lines1] + ** #define in2(c,d) in2[c+d*lines2] + */ + for(i=0;i < lines1 * columns2; ++i) + { + accu = 0; + for(k=0;k < columns1; ++k) + { + accu += in1[i % lines1 + k * lines1] * in2[k + (i / lines1) * lines2]; + + } + out[i] = accu; + + } + +} diff --git a/2.3-1/src/c/matrixOperations/multiplication/u8mulma.c b/2.3-1/src/c/matrixOperations/multiplication/u8mulma.c new file mode 100644 index 00000000..ea630b6f --- /dev/null +++ b/2.3-1/src/c/matrixOperations/multiplication/u8mulma.c @@ -0,0 +1,44 @@ +/*SCilab2C FOSSEE IIT Bombay*/ + +/* +** \brief Compute a multiplication for uint8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ + + +// dgemm function of lapack library does not support uint8,uint16,int8 and int16 datatype so removed + +#include "matrixMultiplication.h" + +void u8mulma(uint8 *in1,int lines1,int columns1, + uint8 *in2,int lines2,int columns2, + uint8 *out) +{ + + int i = 0; + int k = 0; + uint8 accu = 0; + + /* How to convert 2 index matrixes to one. + ** #define in1(a,b) in1[a+b*lines1] + ** #define in2(c,d) in2[c+d*lines2] + */ + for(i=0;i < lines1 * columns2; ++i) + { + accu = 0; + for(k=0;k < columns1; ++k) + { + accu += in1[i % lines1 + k * lines1] * in2[k + (i / lines1) * lines2]; + + } + out[i] = accu; + + } + +} |