summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorimushir2015-12-29 11:55:07 +0530
committerimushir2015-12-29 11:55:07 +0530
commit8afcbca3921b43c6fd977601a2c16755a91e8d91 (patch)
tree89cfb68a983605ab9876bddb5fef2d5a70b7e5a3
parent9e66f0cb2de5e6475bf9bf6956fea40218bd1dd5 (diff)
downloadScilab2C-8afcbca3921b43c6fd977601a2c16755a91e8d91.tar.gz
Scilab2C-8afcbca3921b43c6fd977601a2c16755a91e8d91.tar.bz2
Scilab2C-8afcbca3921b43c6fd977601a2c16755a91e8d91.zip
added support for matrixMultiplication
-rw-r--r--2.3-1/macros/findDeps/getAllSources.sci12
-rw-r--r--2.3-1/src/c/matrixOperations/includes/matrixMultiplication.h59
-rw-r--r--2.3-1/src/c/matrixOperations/interfaces/int_OpStar.h8
-rw-r--r--2.3-1/src/c/matrixOperations/multiplication/i16mulma.c44
-rw-r--r--2.3-1/src/c/matrixOperations/multiplication/i8mulma.c44
-rw-r--r--2.3-1/src/c/matrixOperations/multiplication/u16mulma.c44
-rw-r--r--2.3-1/src/c/matrixOperations/multiplication/u8mulma.c44
7 files changed, 255 insertions, 0 deletions
diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci
index c8d6d0b4..0862e888 100644
--- a/2.3-1/macros/findDeps/getAllSources.sci
+++ b/2.3-1/macros/findDeps/getAllSources.sci
@@ -89,6 +89,14 @@ function allSources = getAllSources(OutFormat)
"src/c/matrixOperations/cat/zcats.c"
"src/c/matrixOperations/cat/ccata.c"
"src/c/matrixOperations/cat/ccats.c"
+ "src/c/matrixOperations/cat/u8cats.c"
+ "src/c/matrixOperations/cat/u8cata.c"
+ "src/c/matrixOperations/cat/u16cats.c"
+ "src/c/matrixOperations/cat/u16cata.c"
+ "src/c/matrixOperations/cat/i8cats.c"
+ "src/c/matrixOperations/cat/i8cata.c"
+ "src/c/matrixOperations/cat/i16cats.c"
+ "src/c/matrixOperations/cat/i16cata.c"
"src/c/matrixOperations/eye/deyea.c"
"src/c/matrixOperations/eye/seyea.c"
"src/c/matrixOperations/eye/zeyea.c"
@@ -178,6 +186,10 @@ function allSources = getAllSources(OutFormat)
"src/c/matrixOperations/multiplication/cmulma.c"
"src/c/matrixOperations/multiplication/dmulma.c"
"src/c/matrixOperations/multiplication/smulma.c"
+ "src/c/matrixOperations/multiplication/u8mulma.c"
+ "src/c/matrixOperations/multiplication/u16mulma.c"
+ "src/c/matrixOperations/multiplication/i8mulma.c"
+ "src/c/matrixOperations/multiplication/i16mulma.c"
"src/c/matrixOperations/division/cldivma.c"
"src/c/matrixOperations/division/zldivma.c"
"src/c/matrixOperations/division/sldivma.c"
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;
+
+ }
+
+}