summaryrefslogtreecommitdiff
path: root/src/c/matrixOperations
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/matrixOperations')
-rw-r--r--src/c/matrixOperations/cat/i16cata.c63
-rw-r--r--src/c/matrixOperations/cat/i16cats.c26
-rw-r--r--src/c/matrixOperations/cat/i8cata.c60
-rw-r--r--src/c/matrixOperations/cat/i8cats.c26
-rw-r--r--src/c/matrixOperations/cat/u16cata.c63
-rw-r--r--src/c/matrixOperations/cat/u16cats.c27
-rw-r--r--src/c/matrixOperations/cat/u8cata.c60
-rw-r--r--src/c/matrixOperations/cat/u8cats.c26
-rw-r--r--src/c/matrixOperations/cross/ccrossa.c37
-rw-r--r--src/c/matrixOperations/cross/dcrossa.c33
-rw-r--r--src/c/matrixOperations/cross/i16crossa.c34
-rw-r--r--src/c/matrixOperations/cross/i8crossa.c34
-rw-r--r--src/c/matrixOperations/cross/scrossa.c33
-rw-r--r--src/c/matrixOperations/cross/u16crossa.c34
-rw-r--r--src/c/matrixOperations/cross/u8crossa.c34
-rw-r--r--src/c/matrixOperations/cross/zcrossa.c37
-rw-r--r--src/c/matrixOperations/cumprod/dcolumncumproda.c39
-rw-r--r--src/c/matrixOperations/cumprod/dcumproda.c31
-rw-r--r--src/c/matrixOperations/cumprod/drowcumproda.c38
-rw-r--r--src/c/matrixOperations/cumprod/i16columncumproda.c39
-rw-r--r--src/c/matrixOperations/cumprod/i16cumproda.c31
-rw-r--r--src/c/matrixOperations/cumprod/i16rowcumproda.c38
-rw-r--r--src/c/matrixOperations/cumprod/i8columncumproda.c39
-rw-r--r--src/c/matrixOperations/cumprod/i8cumproda.c31
-rw-r--r--src/c/matrixOperations/cumprod/i8rowcumproda.c38
-rw-r--r--src/c/matrixOperations/cumprod/scolumncumproda.c39
-rw-r--r--src/c/matrixOperations/cumprod/scumproda.c31
-rw-r--r--src/c/matrixOperations/cumprod/srowcumproda.c38
-rw-r--r--src/c/matrixOperations/cumprod/u16columncumproda.c39
-rw-r--r--src/c/matrixOperations/cumprod/u16cumproda.c31
-rw-r--r--src/c/matrixOperations/cumprod/u16rowcumproda.c38
-rw-r--r--src/c/matrixOperations/cumprod/u8columncumproda.c39
-rw-r--r--src/c/matrixOperations/cumprod/u8cumproda.c31
-rw-r--r--src/c/matrixOperations/cumprod/u8rowcumproda.c38
-rw-r--r--src/c/matrixOperations/cumsum/dcolumncumsuma.c39
-rw-r--r--src/c/matrixOperations/cumsum/dcumsuma.c31
-rw-r--r--src/c/matrixOperations/cumsum/drowcumsuma.c38
-rw-r--r--src/c/matrixOperations/cumsum/i16columncumsuma.c39
-rw-r--r--src/c/matrixOperations/cumsum/i16cumsuma.c31
-rw-r--r--src/c/matrixOperations/cumsum/i16rowcumsuma.c38
-rw-r--r--src/c/matrixOperations/cumsum/i8columncumsuma.c39
-rw-r--r--src/c/matrixOperations/cumsum/i8cumsuma.c31
-rw-r--r--src/c/matrixOperations/cumsum/i8rowcumsuma.c38
-rw-r--r--src/c/matrixOperations/cumsum/scolumncumsuma.c39
-rw-r--r--src/c/matrixOperations/cumsum/scumsuma.c31
-rw-r--r--src/c/matrixOperations/cumsum/srowcumsuma.c38
-rw-r--r--src/c/matrixOperations/cumsum/u16columncumsuma.c39
-rw-r--r--src/c/matrixOperations/cumsum/u16cumsuma.c31
-rw-r--r--src/c/matrixOperations/cumsum/u16rowcumsuma.c38
-rw-r--r--src/c/matrixOperations/cumsum/u8columncumsuma.c39
-rw-r--r--src/c/matrixOperations/cumsum/u8cumsuma.c31
-rw-r--r--src/c/matrixOperations/cumsum/u8rowcumsuma.c38
-rw-r--r--src/c/matrixOperations/determ/i16determa.c92
-rw-r--r--src/c/matrixOperations/determ/i8determa.c92
-rw-r--r--src/c/matrixOperations/determ/u16determa.c92
-rw-r--r--src/c/matrixOperations/determ/u8determa.c92
-rw-r--r--src/c/matrixOperations/diag/ddiaga.c40
-rw-r--r--src/c/matrixOperations/diag/ddiagexa.c130
-rw-r--r--src/c/matrixOperations/diag/ddiagexs.c53
-rw-r--r--src/c/matrixOperations/diag/ddiagina.c59
-rw-r--r--src/c/matrixOperations/diag/ddiagins.c37
-rw-r--r--src/c/matrixOperations/diag/ddiags.c20
-rw-r--r--src/c/matrixOperations/diag/i16diaga.c40
-rw-r--r--src/c/matrixOperations/diag/i16diagexa.c130
-rw-r--r--src/c/matrixOperations/diag/i16diagexs.c53
-rw-r--r--src/c/matrixOperations/diag/i16diagina.c58
-rw-r--r--src/c/matrixOperations/diag/i16diagins.c37
-rw-r--r--src/c/matrixOperations/diag/i16diags.c20
-rw-r--r--src/c/matrixOperations/diag/i8diaga.c40
-rw-r--r--src/c/matrixOperations/diag/i8diagexa.c130
-rw-r--r--src/c/matrixOperations/diag/i8diagexs.c53
-rw-r--r--src/c/matrixOperations/diag/i8diagina.c58
-rw-r--r--src/c/matrixOperations/diag/i8diagins.c37
-rw-r--r--src/c/matrixOperations/diag/i8diags.c20
-rw-r--r--src/c/matrixOperations/diag/u16diaga.c40
-rw-r--r--src/c/matrixOperations/diag/u16diagexa.c130
-rw-r--r--src/c/matrixOperations/diag/u16diagexs.c53
-rw-r--r--src/c/matrixOperations/diag/u16diagina.c58
-rw-r--r--src/c/matrixOperations/diag/u16diagins.c37
-rw-r--r--src/c/matrixOperations/diag/u16diags.c20
-rw-r--r--src/c/matrixOperations/diag/u8diaga.c40
-rw-r--r--src/c/matrixOperations/diag/u8diagexa.c130
-rw-r--r--src/c/matrixOperations/diag/u8diagexs.c53
-rw-r--r--src/c/matrixOperations/diag/u8diagina.c58
-rw-r--r--src/c/matrixOperations/diag/u8diagins.c37
-rw-r--r--src/c/matrixOperations/diag/u8diags.c20
-rw-r--r--src/c/matrixOperations/division/i16ldivma.c111
-rw-r--r--src/c/matrixOperations/division/i16rdivma.c129
-rw-r--r--src/c/matrixOperations/division/i16rdivv.c24
-rw-r--r--src/c/matrixOperations/division/i8ldivma.c111
-rw-r--r--src/c/matrixOperations/division/i8rdivma.c129
-rw-r--r--src/c/matrixOperations/division/i8rdivv.c24
-rw-r--r--src/c/matrixOperations/division/u16ldivma.c111
-rw-r--r--src/c/matrixOperations/division/u16rdivma.c129
-rw-r--r--src/c/matrixOperations/division/u16rdivv.c24
-rw-r--r--src/c/matrixOperations/division/u8ldivma.c111
-rw-r--r--src/c/matrixOperations/division/u8rdivma.c129
-rw-r--r--src/c/matrixOperations/division/u8rdivv.c24
-rw-r--r--src/c/matrixOperations/eye/i16eyea.c23
-rw-r--r--src/c/matrixOperations/eye/i8eyea.c23
-rw-r--r--src/c/matrixOperations/eye/u16eyea.c23
-rw-r--r--src/c/matrixOperations/eye/u8eyea.c23
-rw-r--r--src/c/matrixOperations/flipdim/dflipdima.c81
-rw-r--r--src/c/matrixOperations/flipdim/i16flipdima.c81
-rw-r--r--src/c/matrixOperations/flipdim/i8flipdima.c81
-rw-r--r--src/c/matrixOperations/flipdim/sflipdima.c81
-rw-r--r--src/c/matrixOperations/flipdim/u16flipdima.c81
-rw-r--r--src/c/matrixOperations/flipdim/u8flipdima.c80
-rw-r--r--src/c/matrixOperations/includes/cat.h59
-rw-r--r--src/c/matrixOperations/includes/cross.h37
-rw-r--r--src/c/matrixOperations/includes/cumprod.h53
-rw-r--r--src/c/matrixOperations/includes/cumsum.h53
-rw-r--r--src/c/matrixOperations/includes/diag.h97
-rw-r--r--src/c/matrixOperations/includes/eye.h41
-rw-r--r--src/c/matrixOperations/includes/flipdim.h40
-rw-r--r--src/c/matrixOperations/includes/kron.h32
-rw-r--r--src/c/matrixOperations/includes/matrix.h36
-rw-r--r--src/c/matrixOperations/includes/matrixInversion.h38
-rw-r--r--src/c/matrixOperations/includes/matrixMagnitude.h13
-rw-r--r--src/c/matrixOperations/includes/matrixMultiplication.h59
-rw-r--r--src/c/matrixOperations/includes/matrixTrace.h39
-rw-r--r--src/c/matrixOperations/includes/matrixTranspose.h40
-rw-r--r--src/c/matrixOperations/includes/ndgrid.h31
-rw-r--r--src/c/matrixOperations/includes/nnz.h37
-rw-r--r--src/c/matrixOperations/includes/norm.h32
-rw-r--r--src/c/matrixOperations/includes/ones.h43
-rw-r--r--src/c/matrixOperations/includes/pertrans.h38
-rw-r--r--src/c/matrixOperations/includes/toeplitz.h37
-rw-r--r--src/c/matrixOperations/includes/tril.h34
-rw-r--r--src/c/matrixOperations/includes/triu.h34
-rw-r--r--src/c/matrixOperations/includes/zeros.h40
-rw-r--r--src/c/matrixOperations/interfaces/int_OpStar.h8
-rw-r--r--src/c/matrixOperations/interfaces/int_cat.h359
-rw-r--r--src/c/matrixOperations/interfaces/int_cross.h35
-rw-r--r--src/c/matrixOperations/interfaces/int_cumprod.h54
-rw-r--r--src/c/matrixOperations/interfaces/int_cumsum.h54
-rw-r--r--src/c/matrixOperations/interfaces/int_diag.h85
-rw-r--r--src/c/matrixOperations/interfaces/int_eye.h35
-rw-r--r--src/c/matrixOperations/interfaces/int_flipdim.h109
-rw-r--r--src/c/matrixOperations/interfaces/int_invert.h16
-rw-r--r--src/c/matrixOperations/interfaces/int_kron.h43
-rw-r--r--src/c/matrixOperations/interfaces/int_matrix.h49
-rw-r--r--src/c/matrixOperations/interfaces/int_ndgrid.h28
-rw-r--r--src/c/matrixOperations/interfaces/int_nnz.h35
-rw-r--r--src/c/matrixOperations/interfaces/int_norm.h53
-rw-r--r--src/c/matrixOperations/interfaces/int_ones.h34
-rw-r--r--src/c/matrixOperations/interfaces/int_permute.h28
-rw-r--r--src/c/matrixOperations/interfaces/int_pertrans.h34
-rw-r--r--src/c/matrixOperations/interfaces/int_toeplitz.h50
-rw-r--r--src/c/matrixOperations/interfaces/int_trace.h16
-rw-r--r--src/c/matrixOperations/interfaces/int_transpose.h17
-rw-r--r--src/c/matrixOperations/interfaces/int_tril.h62
-rw-r--r--src/c/matrixOperations/interfaces/int_triu.h62
-rw-r--r--src/c/matrixOperations/interfaces/int_vmagn.h16
-rw-r--r--src/c/matrixOperations/interfaces/int_zeros.h37
-rw-r--r--[-rwxr-xr-x]src/c/matrixOperations/interfaces/interface.sh0
-rw-r--r--src/c/matrixOperations/inversion/i16inverma.c55
-rw-r--r--src/c/matrixOperations/inversion/i8inverma.c55
-rw-r--r--src/c/matrixOperations/inversion/u16inverma.c55
-rw-r--r--src/c/matrixOperations/inversion/u8inverma.c55
-rw-r--r--src/c/matrixOperations/kron/dkrona.c39
-rw-r--r--src/c/matrixOperations/kron/skrona.c39
-rw-r--r--src/c/matrixOperations/magnitude/i16magna.c43
-rw-r--r--src/c/matrixOperations/magnitude/i16magns.c22
-rw-r--r--src/c/matrixOperations/magnitude/i8magna.c43
-rw-r--r--src/c/matrixOperations/magnitude/i8magns.c22
-rw-r--r--src/c/matrixOperations/magnitude/u16magna.c33
-rw-r--r--src/c/matrixOperations/magnitude/u16magns.c13
-rw-r--r--src/c/matrixOperations/magnitude/u8magna.c33
-rw-r--r--src/c/matrixOperations/magnitude/u8magns.c13
-rw-r--r--src/c/matrixOperations/matrix/dmatrixa.c33
-rw-r--r--src/c/matrixOperations/matrix/smatrixa.c33
-rw-r--r--src/c/matrixOperations/matrix/u16matrixa.c33
-rw-r--r--src/c/matrixOperations/matrix/zmatrixa.c33
-rw-r--r--src/c/matrixOperations/multiplication/i16mulma.c54
-rw-r--r--src/c/matrixOperations/multiplication/i8mulma.c54
-rw-r--r--src/c/matrixOperations/multiplication/u16mulma.c54
-rw-r--r--src/c/matrixOperations/multiplication/u8mulma.c54
-rw-r--r--src/c/matrixOperations/ndgrid/dndgrida.c31
-rw-r--r--src/c/matrixOperations/ndgrid/sndgrida.c32
-rw-r--r--src/c/matrixOperations/ndgrid/zndgrida.c39
-rw-r--r--src/c/matrixOperations/nnz/dnnza.c33
-rw-r--r--src/c/matrixOperations/nnz/dnnzs.c25
-rw-r--r--src/c/matrixOperations/nnz/snnza.c33
-rw-r--r--src/c/matrixOperations/nnz/snnzs.c25
-rw-r--r--src/c/matrixOperations/nnz/znnza.c33
-rw-r--r--src/c/matrixOperations/nnz/znnzs.c26
-rw-r--r--src/c/matrixOperations/norm/dnorma.c80
-rw-r--r--src/c/matrixOperations/norm/dnormv.c60
-rw-r--r--src/c/matrixOperations/norm/snorma.c72
-rw-r--r--src/c/matrixOperations/norm/snormv.c60
-rw-r--r--src/c/matrixOperations/ones/i16onesa.c28
-rw-r--r--src/c/matrixOperations/ones/i8onesa.c28
-rw-r--r--src/c/matrixOperations/ones/u16onesa.c28
-rw-r--r--src/c/matrixOperations/ones/u8onesa.c28
-rw-r--r--src/c/matrixOperations/pertrans/dpertransa.c36
-rw-r--r--src/c/matrixOperations/pertrans/dpertranss.c23
-rw-r--r--src/c/matrixOperations/pertrans/spertransa.c36
-rw-r--r--src/c/matrixOperations/pertrans/spertranss.c23
-rw-r--r--src/c/matrixOperations/pertrans/zpertransa.c37
-rw-r--r--src/c/matrixOperations/pertrans/zpertranss.c24
-rw-r--r--src/c/matrixOperations/toeplitz/ctoeplitza.c36
-rw-r--r--src/c/matrixOperations/toeplitz/dtoeplitza.c33
-rw-r--r--src/c/matrixOperations/toeplitz/gtoeplitza.c35
-rw-r--r--src/c/matrixOperations/toeplitz/i16toeplitza.c32
-rw-r--r--src/c/matrixOperations/toeplitz/i8toeplitza.c33
-rw-r--r--src/c/matrixOperations/toeplitz/stoeplitza.c32
-rw-r--r--src/c/matrixOperations/toeplitz/u16toeplitza.c33
-rw-r--r--src/c/matrixOperations/toeplitz/u8toeplitza.c33
-rw-r--r--src/c/matrixOperations/toeplitz/ztoeplitza.c36
-rw-r--r--src/c/matrixOperations/trace/i16tracea.c28
-rw-r--r--src/c/matrixOperations/trace/i8tracea.c28
-rw-r--r--src/c/matrixOperations/trace/u16tracea.c28
-rw-r--r--src/c/matrixOperations/trace/u8tracea.c28
-rw-r--r--src/c/matrixOperations/transpose/i16transposea.c27
-rw-r--r--src/c/matrixOperations/transpose/i8transposea.c27
-rw-r--r--src/c/matrixOperations/transpose/u16transposea.c27
-rw-r--r--src/c/matrixOperations/transpose/u8transposea.c27
-rw-r--r--src/c/matrixOperations/tril/dtrila.c35
-rw-r--r--src/c/matrixOperations/tril/i16trila.c35
-rw-r--r--src/c/matrixOperations/tril/i8trila.c35
-rw-r--r--src/c/matrixOperations/tril/strila.c35
-rw-r--r--src/c/matrixOperations/tril/u16trila.c35
-rw-r--r--src/c/matrixOperations/tril/u8trila.c35
-rw-r--r--src/c/matrixOperations/triu/dtriua.c35
-rw-r--r--src/c/matrixOperations/triu/i16triua.c35
-rw-r--r--src/c/matrixOperations/triu/i8triua.c35
-rw-r--r--src/c/matrixOperations/triu/striua.c35
-rw-r--r--src/c/matrixOperations/triu/u16triua.c35
-rw-r--r--src/c/matrixOperations/triu/u8triua.c36
-rw-r--r--src/c/matrixOperations/zeros/i16zerosa.c28
-rw-r--r--src/c/matrixOperations/zeros/i8zerosa.c28
-rw-r--r--src/c/matrixOperations/zeros/u16zerosa.c28
-rw-r--r--src/c/matrixOperations/zeros/u8zerosa.c28
234 files changed, 10658 insertions, 3 deletions
diff --git a/src/c/matrixOperations/cat/i16cata.c b/src/c/matrixOperations/cat/i16cata.c
new file mode 100644
index 00000000..d7187b4a
--- /dev/null
+++ b/src/c/matrixOperations/cat/i16cata.c
@@ -0,0 +1,63 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include "cat.h"
+/* From scilab help cat then the concatenation is done according to the rows
+A1 = [1 2 3;4 5 6];
+A2 = [7 8 9;10 11 12];
+y = cat(1,A1,A2);
+output => y = [1 2 3; 4 5 6;7 8 9;10 11 12]
+*/
+
+void i16rowcata(int16 *in1,int lines1,int columns1,int16 *in2,int lines2,int columns2,int16* out)
+{
+ int i = 0;
+ int j = 0;
+ for(i = 0;i < columns1 && i < columns2; ++i)
+ {
+ for(j = 0;j < lines1; ++j)
+ {
+ out[i*(lines1 + lines2) + j] = in1[i*lines1 + j];
+ }
+ for(j = 0;j < lines2; ++j)
+ {
+ out[i*(lines1 + lines2) + lines1 + j] = in2[i*lines2 + j];
+ }
+
+ }
+}
+
+ /* From scilab help cat then the concatenation is done according to the rows
+A1 = [1 2 3;4 5 6];
+A2 = [7 8 9;10 11 12];
+y = cat(2,A1,A2);
+output => y = [1 2 3 7 8 9; 4 5 6 10 11 12]
+*/
+
+void i16columncata(int16 *in1,int lines1,int columns1,int16 *in2,int lines2,int columns2,int16* out)
+ {
+ int i = 0;
+ for(i = 0; i < lines1 * columns1;++i)
+ {
+ out[i] = in1[i];
+
+ }
+ for(i = 0;i < lines2 * columns2;++i)
+ {
+
+ out[i + lines1 * columns2] = in2[i];
+
+ }
+
+ }
+
+
+
diff --git a/src/c/matrixOperations/cat/i16cats.c b/src/c/matrixOperations/cat/i16cats.c
new file mode 100644
index 00000000..11b24ac6
--- /dev/null
+++ b/src/c/matrixOperations/cat/i16cats.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include "cat.h"
+
+void i16rowcats(int16 in1,int16 in2,int16 *out)
+{
+ out[0] = in1;
+ out[1] = in2;
+
+}
+
+void i16columncats(int16 in1,int16 in2,int16 *out)
+{
+ out[0] = in1;
+ out[1] = in2;
+
+}
diff --git a/src/c/matrixOperations/cat/i8cata.c b/src/c/matrixOperations/cat/i8cata.c
new file mode 100644
index 00000000..47fbfa40
--- /dev/null
+++ b/src/c/matrixOperations/cat/i8cata.c
@@ -0,0 +1,60 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include "cat.h"
+/* From scilab help cat then the concatenation is done according to the rows
+A1 = [1 2 3;4 5 6];
+A2 = [7 8 9;10 11 12];
+y = cat(1,A1,A2);
+output => y = [1 2 3; 4 5 6;7 8 9;10 11 12]
+*/
+
+void i8rowcata(int8 *in1,int lines1,int columns1,int8 *in2,int lines2,int columns2,int8* out)
+{
+ int i = 0;
+ int j = 0;
+ for(i = 0;i < columns1 && i < columns2; ++i)
+ {
+ for(j = 0;j < lines1; ++j)
+ {
+ out[i*(lines1 + lines2) + j] = in1[i*lines1 + j];
+ }
+ for(j = 0;j < lines2; ++j)
+ {
+ out[i*(lines1 + lines2) + lines1 + j] = in2[i*lines2 + j];
+ }
+
+ }
+}
+ /* From scilab help cat then the concatenation is done according to the rows
+A1 = [1 2 3;4 5 6];
+A2 = [7 8 9;10 11 12];
+y = cat(2,A1,A2);
+output => y = [1 2 3 7 8 9; 4 5 6 10 11 12]
+*/
+
+void i8columncata(int8 *in1,int lines1,int columns1,int8 *in2,int lines2,int columns2,int8* out)
+ {
+ int i = 0;
+ for(i = 0; i < lines1 * columns1;++i)
+ {
+ out[i] = in1[i];
+
+ }
+ for(i = 0;i < lines2 * columns2;++i)
+ {
+
+ out[i + lines1 * columns2] = in2[i];
+
+ }
+
+ }
+
diff --git a/src/c/matrixOperations/cat/i8cats.c b/src/c/matrixOperations/cat/i8cats.c
new file mode 100644
index 00000000..51dadd16
--- /dev/null
+++ b/src/c/matrixOperations/cat/i8cats.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include "cat.h"
+
+void i8rowcats(int8 in1,int8 in2,int8 *out)
+{
+ out[0] = in1;
+ out[1] = in2;
+
+}
+
+void i8columncats(int8 in1,uint8 in2,int8 *out)
+{
+ out[0] = in1;
+ out[1] = in2;
+
+}
diff --git a/src/c/matrixOperations/cat/u16cata.c b/src/c/matrixOperations/cat/u16cata.c
new file mode 100644
index 00000000..8c33acb9
--- /dev/null
+++ b/src/c/matrixOperations/cat/u16cata.c
@@ -0,0 +1,63 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include "cat.h"
+/* From scilab help cat then the concatenation is done according to the rows
+A1 = [1 2 3;4 5 6];
+A2 = [7 8 9;10 11 12];
+y = cat(1,A1,A2);
+output => y = [1 2 3; 4 5 6;7 8 9;10 11 12]
+*/
+
+void u16rowcata(uint16 *in1,int lines1,int columns1,uint16 *in2,int lines2,int columns2,uint16* out)
+{
+ int i = 0;
+ int j = 0;
+ for(i = 0;i < columns1 && i < columns2; ++i)
+ {
+ for(j = 0;j < lines1; ++j)
+ {
+ out[i*(lines1 + lines2) + j] = in1[i*lines1 + j];
+ }
+ for(j = 0;j < lines2; ++j)
+ {
+ out[i*(lines1 + lines2) + lines1 + j] = in2[i*lines2 + j];
+ }
+
+ }
+}
+
+ /* From scilab help cat then the concatenation is done according to the rows
+A1 = [1 2 3;4 5 6];
+A2 = [7 8 9;10 11 12];
+y = cat(2,A1,A2);
+output => y = [1 2 3 7 8 9; 4 5 6 10 11 12]
+*/
+
+void u16columncata(uint16 *in1,int lines1,int columns1,uint16 *in2,int lines2,int columns2,uint16* out)
+ {
+ int i = 0;
+ for(i = 0; i < lines1 * columns1;++i)
+ {
+ out[i] = in1[i];
+
+ }
+ for(i = 0;i < lines2 * columns2;++i)
+ {
+
+ out[i + lines1 * columns2] = in2[i];
+
+ }
+
+ }
+
+
+
diff --git a/src/c/matrixOperations/cat/u16cats.c b/src/c/matrixOperations/cat/u16cats.c
new file mode 100644
index 00000000..942ed769
--- /dev/null
+++ b/src/c/matrixOperations/cat/u16cats.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "cat.h"
+
+void u16rowcats(uint16 in1,uint16 in2,uint16 *out)
+{
+ out[0] = in1;
+ out[1] = in2;
+
+}
+
+void u16columncats(uint16 in1,uint16 in2,uint16 *out)
+{
+ out[0] = in1;
+ out[1] = in2;
+
+}
diff --git a/src/c/matrixOperations/cat/u8cata.c b/src/c/matrixOperations/cat/u8cata.c
new file mode 100644
index 00000000..ab15f42f
--- /dev/null
+++ b/src/c/matrixOperations/cat/u8cata.c
@@ -0,0 +1,60 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include "cat.h"
+/* From scilab help cat then the concatenation is done according to the rows
+A1 = [1 2 3;4 5 6];
+A2 = [7 8 9;10 11 12];
+y = cat(1,A1,A2);
+output => y = [1 2 3; 4 5 6;7 8 9;10 11 12]
+*/
+
+void u8rowcata(uint8 *in1,int lines1,int columns1,uint8 *in2,int lines2,int columns2,uint8* out)
+{
+ int i = 0;
+ int j = 0;
+ for(i = 0;i < columns1 && i < columns2; ++i)
+ {
+ for(j = 0;j < lines1; ++j)
+ {
+ out[i*(lines1 + lines2) + j] = in1[i*lines1 + j];
+ }
+ for(j = 0;j < lines2; ++j)
+ {
+ out[i*(lines1 + lines2) + lines1 + j] = in2[i*lines2 + j];
+ }
+
+ }
+}
+ /* From scilab help cat then the concatenation is done according to the rows
+A1 = [1 2 3;4 5 6];
+A2 = [7 8 9;10 11 12];
+y = cat(2,A1,A2);
+output => y = [1 2 3 7 8 9; 4 5 6 10 11 12]
+*/
+
+void u8columncata(uint8 *in1,int lines1,int columns1,uint8 *in2,int lines2,int columns2,uint8* out)
+ {
+ int i = 0;
+ for(i = 0; i < lines1 * columns1;++i)
+ {
+ out[i] = in1[i];
+
+ }
+ for(i = 0;i < lines2 * columns2;++i)
+ {
+
+ out[i + lines1 * columns2] = in2[i];
+
+ }
+
+ }
+
diff --git a/src/c/matrixOperations/cat/u8cats.c b/src/c/matrixOperations/cat/u8cats.c
new file mode 100644
index 00000000..92341f3b
--- /dev/null
+++ b/src/c/matrixOperations/cat/u8cats.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include "cat.h"
+
+void u8rowcats(uint8 in1,uint8 in2,uint8 *out)
+{
+ out[0] = in1;
+ out[1] = in2;
+
+}
+
+void u8columncats(uint8 in1,uint8 in2,uint8 *out)
+{
+ out[0] = in1;
+ out[1] = in2;
+
+}
diff --git a/src/c/matrixOperations/cross/ccrossa.c b/src/c/matrixOperations/cross/ccrossa.c
new file mode 100644
index 00000000..5f74bb36
--- /dev/null
+++ b/src/c/matrixOperations/cross/ccrossa.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cross.h>
+#include "floatComplex.h"
+#include "stdlib.h"
+#include "string.h"
+#include "cat.h"
+
+void ccrossa (floatComplex* inp1, int size1_r, int size1_c, floatComplex* inp2, int size2_r, int size2_c ,floatComplex* oup)
+{
+ int i,j;
+
+ if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix
+ {
+ oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1];
+ oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2];
+ oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0];
+ printf("%lf ", oup[0]);
+ printf("%lf ", oup[1]);
+ printf("%lf \n", oup[2]);
+ }
+ else // Calculating the cross product for a 3XN Matrix
+ {
+ for(i = 0; i < size1_r; i++)
+ {
+ for(j = 0; j < size1_c; j = j+3)
+ {
+ oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)];
+ oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)];
+ oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)];
+
+ }
+ }
+
+ }
+}
+
diff --git a/src/c/matrixOperations/cross/dcrossa.c b/src/c/matrixOperations/cross/dcrossa.c
new file mode 100644
index 00000000..203ec24b
--- /dev/null
+++ b/src/c/matrixOperations/cross/dcrossa.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cross.h>
+
+void dcrossa (double* inp1, int size1_r, int size1_c, double* inp2, int size2_r, int size2_c ,double* oup)
+{
+ int i,j;
+
+ if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix
+ {
+ oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1];
+ oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2];
+ oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0];
+ printf("%lf ", oup[0]);
+ printf("%lf ", oup[1]);
+ printf("%lf \n", oup[2]);
+ }
+ else // Calculating the cross product for a 3XN Matrix
+ {
+ for(i = 0; i < size1_r; i++)
+ {
+ for(j = 0; j < size1_c; j = j+3)
+ {
+ oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)];
+ oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)];
+ oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)];
+
+ }
+ }
+
+ }
+}
+
diff --git a/src/c/matrixOperations/cross/i16crossa.c b/src/c/matrixOperations/cross/i16crossa.c
new file mode 100644
index 00000000..91cdb7f0
--- /dev/null
+++ b/src/c/matrixOperations/cross/i16crossa.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cross.h>
+#include "int16.h"
+
+void i16crossa (int16* inp1, int size1_r, int size1_c, int16* inp2, int size2_r, int size2_c ,int16* oup)
+{
+ int i,j;
+
+ if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix
+ {
+ oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1];
+ oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2];
+ oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0];
+ printf("%lf ", oup[0]);
+ printf("%lf ", oup[1]);
+ printf("%lf \n", oup[2]);
+ }
+ else // Calculating the cross product for a 3XN Matrix
+ {
+ for(i = 0; i < size1_r; i++)
+ {
+ for(j = 0; j < size1_c; j = j+3)
+ {
+ oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)];
+ oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)];
+ oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)];
+
+ }
+ }
+
+ }
+}
+
diff --git a/src/c/matrixOperations/cross/i8crossa.c b/src/c/matrixOperations/cross/i8crossa.c
new file mode 100644
index 00000000..adfbd534
--- /dev/null
+++ b/src/c/matrixOperations/cross/i8crossa.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cross.h>
+#include "int8.h"
+
+void i8crossa (int8* inp1, int size1_r, int size1_c, int8* inp2, int size2_r, int size2_c ,int8* oup)
+{
+ int i,j;
+
+ if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix
+ {
+ oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1];
+ oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2];
+ oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0];
+ printf("%lf ", oup[0]);
+ printf("%lf ", oup[1]);
+ printf("%lf \n", oup[2]);
+ }
+ else // Calculating the cross product for a 3XN Matrix
+ {
+ for(i = 0; i < size1_r; i++)
+ {
+ for(j = 0; j < size1_c; j = j+3)
+ {
+ oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)];
+ oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)];
+ oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)];
+
+ }
+ }
+
+ }
+}
+
diff --git a/src/c/matrixOperations/cross/scrossa.c b/src/c/matrixOperations/cross/scrossa.c
new file mode 100644
index 00000000..414b85a4
--- /dev/null
+++ b/src/c/matrixOperations/cross/scrossa.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cross.h>
+
+void scrossa (float* inp1, int size1_r, int size1_c, float* inp2, int size2_r, int size2_c ,float* oup)
+{
+ int i,j;
+
+ if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix
+ {
+ oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1];
+ oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2];
+ oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0];
+ printf("%lf ", oup[0]);
+ printf("%lf ", oup[1]);
+ printf("%lf \n", oup[2]);
+ }
+ else // Calculating the cross product for a 3XN Matrix
+ {
+ for(i = 0; i < size1_r; i++)
+ {
+ for(j = 0; j < size1_c; j = j+3)
+ {
+ oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)];
+ oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)];
+ oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)];
+
+ }
+ }
+
+ }
+}
+
diff --git a/src/c/matrixOperations/cross/u16crossa.c b/src/c/matrixOperations/cross/u16crossa.c
new file mode 100644
index 00000000..e0a32bcc
--- /dev/null
+++ b/src/c/matrixOperations/cross/u16crossa.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cross.h>
+#include "uint16.h"
+
+void u16crossa (uint16* inp1, int size1_r, int size1_c, uint16* inp2, int size2_r, int size2_c ,uint16* oup)
+{
+ int i,j;
+
+ if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix
+ {
+ oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1];
+ oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2];
+ oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0];
+ printf("%lf ", oup[0]);
+ printf("%lf ", oup[1]);
+ printf("%lf \n", oup[2]);
+ }
+ else // Calculating the cross product for a 3XN Matrix
+ {
+ for(i = 0; i < size1_r; i++)
+ {
+ for(j = 0; j < size1_c; j = j+3)
+ {
+ oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)];
+ oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)];
+ oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)];
+
+ }
+ }
+
+ }
+}
+
diff --git a/src/c/matrixOperations/cross/u8crossa.c b/src/c/matrixOperations/cross/u8crossa.c
new file mode 100644
index 00000000..7a8b857f
--- /dev/null
+++ b/src/c/matrixOperations/cross/u8crossa.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cross.h>
+#include "uint8.h"
+
+void u8crossa (uint8* inp1, int size1_r, int size1_c, uint8* inp2, int size2_r, int size2_c ,uint8* oup)
+{
+ int i,j;
+
+ if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix
+ {
+ oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1];
+ oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2];
+ oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0];
+ printf("%lf ", oup[0]);
+ printf("%lf ", oup[1]);
+ printf("%lf \n", oup[2]);
+ }
+ else // Calculating the cross product for a 3XN Matrix
+ {
+ for(i = 0; i < size1_r; i++)
+ {
+ for(j = 0; j < size1_c; j = j+3)
+ {
+ oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)];
+ oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)];
+ oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)];
+
+ }
+ }
+
+ }
+}
+
diff --git a/src/c/matrixOperations/cross/zcrossa.c b/src/c/matrixOperations/cross/zcrossa.c
new file mode 100644
index 00000000..85a19607
--- /dev/null
+++ b/src/c/matrixOperations/cross/zcrossa.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cross.h>
+#include "doubleComplex.h"
+#include "stdlib.h"
+#include "string.h"
+#include "cat.h"
+
+void zcrossa (doubleComplex* inp1, int size1_r, int size1_c, doubleComplex* inp2, int size2_r, int size2_c ,doubleComplex* oup)
+{
+ int i,j;
+
+ if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix
+ {
+ oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1];
+ oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2];
+ oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0];
+ printf("%lf ", oup[0]);
+ printf("%lf ", oup[1]);
+ printf("%lf \n", oup[2]);
+ }
+ else // Calculating the cross product for a 3XN Matrix
+ {
+ for(i = 0; i < size1_r; i++)
+ {
+ for(j = 0; j < size1_c; j = j+3)
+ {
+ oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)];
+ oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)];
+ oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)];
+
+ }
+ }
+
+ }
+}
+
diff --git a/src/c/matrixOperations/cumprod/dcolumncumproda.c b/src/c/matrixOperations/cumprod/dcolumncumproda.c
new file mode 100644
index 00000000..b64fac48
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/dcolumncumproda.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void dcolumncumproda(double *in1, int row, int column, double *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/dcumproda.c b/src/c/matrixOperations/cumprod/dcumproda.c
new file mode 100644
index 00000000..199880c6
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/dcumproda.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void dcumproda(double *in1, int row, int column, double *out)
+{
+ int row_cnt, col_cnt = 0;
+ double cumprod = 1;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumprod *= in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumprod;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/drowcumproda.c b/src/c/matrixOperations/cumprod/drowcumproda.c
new file mode 100644
index 00000000..21082d0c
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/drowcumproda.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void drowcumproda(double *in1, int row, int column, double *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/i16columncumproda.c b/src/c/matrixOperations/cumprod/i16columncumproda.c
new file mode 100644
index 00000000..e5af54bb
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/i16columncumproda.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+ /*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void i16columncumproda(int16 *in1, int row, int column, int16 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/i16cumproda.c b/src/c/matrixOperations/cumprod/i16cumproda.c
new file mode 100644
index 00000000..8bee315d
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/i16cumproda.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void i16cumproda(int16 *in1, int row, int column, int16 *out)
+{
+ int row_cnt, col_cnt = 0;
+ int16 cumprod = 1;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumprod *= in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumprod;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/i16rowcumproda.c b/src/c/matrixOperations/cumprod/i16rowcumproda.c
new file mode 100644
index 00000000..0c38b5eb
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/i16rowcumproda.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void i16rowcumproda(int16 *in1, int row, int column, int16 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/i8columncumproda.c b/src/c/matrixOperations/cumprod/i8columncumproda.c
new file mode 100644
index 00000000..cf2156dd
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/i8columncumproda.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void i8columncumproda(int8 *in1, int row, int column, int8 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/i8cumproda.c b/src/c/matrixOperations/cumprod/i8cumproda.c
new file mode 100644
index 00000000..f0a54043
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/i8cumproda.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void i8cumproda(int8 *in1, int row, int column, int8 *out)
+{
+ int row_cnt, col_cnt = 0;
+ int8 cumprod = 1;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumprod *= in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumprod;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/i8rowcumproda.c b/src/c/matrixOperations/cumprod/i8rowcumproda.c
new file mode 100644
index 00000000..c2ecf199
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/i8rowcumproda.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void i8rowcumproda(int8 *in1, int row, int column, int8 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/scolumncumproda.c b/src/c/matrixOperations/cumprod/scolumncumproda.c
new file mode 100644
index 00000000..e97ca903
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/scolumncumproda.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void scolumncumproda(float *in1, int row, int column, float *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/scumproda.c b/src/c/matrixOperations/cumprod/scumproda.c
new file mode 100644
index 00000000..fb55a31a
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/scumproda.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void scumproda(float *in1, int row, int column, float *out)
+{
+ int row_cnt, col_cnt = 0;
+ float cumprod = 1;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumprod += in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumprod;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/srowcumproda.c b/src/c/matrixOperations/cumprod/srowcumproda.c
new file mode 100644
index 00000000..cab4e443
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/srowcumproda.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void srowcumproda(float *in1, int row, int column, float *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/u16columncumproda.c b/src/c/matrixOperations/cumprod/u16columncumproda.c
new file mode 100644
index 00000000..7b3c2d87
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/u16columncumproda.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void u16columncumproda(uint16 *in1, int row, int column, uint16 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/u16cumproda.c b/src/c/matrixOperations/cumprod/u16cumproda.c
new file mode 100644
index 00000000..5740e86f
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/u16cumproda.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void u16cumproda(uint16 *in1, int row, int column, uint16 *out)
+{
+ int row_cnt, col_cnt = 0;
+ uint16 cumprod = 1;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumprod *= in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumprod;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/u16rowcumproda.c b/src/c/matrixOperations/cumprod/u16rowcumproda.c
new file mode 100644
index 00000000..23b452c4
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/u16rowcumproda.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void u16rowcumproda(uint16 *in1, int row, int column, uint16 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/u8columncumproda.c b/src/c/matrixOperations/cumprod/u8columncumproda.c
new file mode 100644
index 00000000..3a6ee92c
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/u8columncumproda.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void u8columncumproda(uint8 *in1, int row, int column, uint8 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/u8cumproda.c b/src/c/matrixOperations/cumprod/u8cumproda.c
new file mode 100644
index 00000000..8970f193
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/u8cumproda.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void u8cumproda(uint8 *in1, int row, int column, uint8 *out)
+{
+ int row_cnt, col_cnt = 0;
+ uint8 cumprod = 1;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumprod *= in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumprod;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumprod/u8rowcumproda.c b/src/c/matrixOperations/cumprod/u8rowcumproda.c
new file mode 100644
index 00000000..61b214c3
--- /dev/null
+++ b/src/c/matrixOperations/cumprod/u8rowcumproda.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumprod.h"
+#include "types.h"
+
+void u8rowcumproda(uint8 *in1, int row, int column, uint8 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ * out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/dcolumncumsuma.c b/src/c/matrixOperations/cumsum/dcolumncumsuma.c
new file mode 100644
index 00000000..daf60134
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/dcolumncumsuma.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void dcolumncumsuma(double *in1, int row, int column, double *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/dcumsuma.c b/src/c/matrixOperations/cumsum/dcumsuma.c
new file mode 100644
index 00000000..11b0a88f
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/dcumsuma.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void dcumsuma(double *in1, int row, int column, double *out)
+{
+ int row_cnt, col_cnt = 0;
+ double cumsum = 0;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumsum += in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumsum;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/drowcumsuma.c b/src/c/matrixOperations/cumsum/drowcumsuma.c
new file mode 100644
index 00000000..4bb3f320
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/drowcumsuma.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void drowcumsuma(double *in1, int row, int column, double *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/i16columncumsuma.c b/src/c/matrixOperations/cumsum/i16columncumsuma.c
new file mode 100644
index 00000000..ae84428b
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/i16columncumsuma.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void i16columncumsuma(int16 *in1, int row, int column, int16 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/i16cumsuma.c b/src/c/matrixOperations/cumsum/i16cumsuma.c
new file mode 100644
index 00000000..4e2fb591
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/i16cumsuma.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void i16cumsuma(int16 *in1, int row, int column, int16 *out)
+{
+ int row_cnt, col_cnt = 0;
+ int16 cumsum = 0;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumsum += in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumsum;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/i16rowcumsuma.c b/src/c/matrixOperations/cumsum/i16rowcumsuma.c
new file mode 100644
index 00000000..67cb9c7f
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/i16rowcumsuma.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void i16rowcumsuma(int16 *in1, int row, int column, int16 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/i8columncumsuma.c b/src/c/matrixOperations/cumsum/i8columncumsuma.c
new file mode 100644
index 00000000..67f72bcc
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/i8columncumsuma.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void i8columncumsuma(int8 *in1, int row, int column, int8 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/i8cumsuma.c b/src/c/matrixOperations/cumsum/i8cumsuma.c
new file mode 100644
index 00000000..8aa92871
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/i8cumsuma.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void i8cumsuma(int8 *in1, int row, int column, int8 *out)
+{
+ int row_cnt, col_cnt = 0;
+ int8 cumsum = 0;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumsum += in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumsum;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/i8rowcumsuma.c b/src/c/matrixOperations/cumsum/i8rowcumsuma.c
new file mode 100644
index 00000000..a9e7da81
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/i8rowcumsuma.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void i8rowcumsuma(int8 *in1, int row, int column, int8 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/scolumncumsuma.c b/src/c/matrixOperations/cumsum/scolumncumsuma.c
new file mode 100644
index 00000000..a7e8a851
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/scolumncumsuma.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void scolumncumsuma(float *in1, int row, int column, float *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/scumsuma.c b/src/c/matrixOperations/cumsum/scumsuma.c
new file mode 100644
index 00000000..122e165d
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/scumsuma.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void scumsuma(float *in1, int row, int column, float *out)
+{
+ int row_cnt, col_cnt = 0;
+ float cumsum = 0;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumsum += in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumsum;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/srowcumsuma.c b/src/c/matrixOperations/cumsum/srowcumsuma.c
new file mode 100644
index 00000000..3af5d367
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/srowcumsuma.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void srowcumsuma(float *in1, int row, int column, float *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/u16columncumsuma.c b/src/c/matrixOperations/cumsum/u16columncumsuma.c
new file mode 100644
index 00000000..aa16a582
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/u16columncumsuma.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void u16columncumsuma(uint16 *in1, int row, int column, uint16 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/u16cumsuma.c b/src/c/matrixOperations/cumsum/u16cumsuma.c
new file mode 100644
index 00000000..d403571a
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/u16cumsuma.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void u16cumsuma(uint16 *in1, int row, int column, uint16 *out)
+{
+ int row_cnt, col_cnt = 0;
+ uint16 cumsum = 0;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumsum += in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumsum;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/u16rowcumsuma.c b/src/c/matrixOperations/cumsum/u16rowcumsuma.c
new file mode 100644
index 00000000..0ef0945c
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/u16rowcumsuma.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void u16rowcumsuma(uint16 *in1, int row, int column, uint16 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/u8columncumsuma.c b/src/c/matrixOperations/cumsum/u8columncumsuma.c
new file mode 100644
index 00000000..890a0bee
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/u8columncumsuma.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void u8columncumsuma(uint8 *in1, int row, int column, uint8 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*Assign elements in first column as it is*/
+ for(row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ out[row_cnt] = in1[row_cnt];
+ }
+
+ /*For second column onwards*/
+ for (row_cnt = 0; row_cnt < row; row_cnt++)
+ {
+ for ( col_cnt = 1; col_cnt < column; col_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[(col_cnt-1)*row+row_cnt];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/u8cumsuma.c b/src/c/matrixOperations/cumsum/u8cumsuma.c
new file mode 100644
index 00000000..4f2acfe6
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/u8cumsuma.c
@@ -0,0 +1,31 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void u8cumsuma(uint8 *in1, int row, int column, uint8 *out)
+{
+ int row_cnt, col_cnt = 0;
+ uint8 cumsum = 0;
+ for (col_cnt = 0; col_cnt < row; col_cnt++)
+ {
+ for ( row_cnt = 0; row_cnt < column; row_cnt++)
+ {
+ cumsum += in1[col_cnt*column+row_cnt];
+ out[col_cnt*column+row_cnt] = cumsum;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/cumsum/u8rowcumsuma.c b/src/c/matrixOperations/cumsum/u8rowcumsuma.c
new file mode 100644
index 00000000..1204d83e
--- /dev/null
+++ b/src/c/matrixOperations/cumsum/u8rowcumsuma.c
@@ -0,0 +1,38 @@
+/* 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
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "cumsum.h"
+#include "types.h"
+
+void u8rowcumsuma(uint8 *in1, int row, int column, uint8 *out)
+{
+ int row_cnt, col_cnt = 0;
+
+ /*assign elements in first row as it is*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ out[col_cnt*row] = in1[col_cnt*row];
+ }
+ /*For second row onwards*/
+ for (col_cnt = 0; col_cnt < column; col_cnt++)
+ {
+ for ( row_cnt = 1; row_cnt < row; row_cnt++)
+ {
+
+ out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \
+ + out[col_cnt*row+row_cnt -1];
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/determ/i16determa.c b/src/c/matrixOperations/determ/i16determa.c
new file mode 100644
index 00000000..97ec948b
--- /dev/null
+++ b/src/c/matrixOperations/determ/i16determa.c
@@ -0,0 +1,92 @@
+/* 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 <stdlib.h>
+#ifndef WITHOUT_LAPACK
+#include "lapack.h"
+#endif
+#include "determ.h"
+#include "lapack.h"
+
+int16 i16determa(int16 * in, int size){
+#ifndef WITHOUT_LAPACK
+ int i=0, info=0;
+ int16 out=0;
+ int16 *inCopy=NULL;
+ int* tmp=NULL;
+
+ /*Calculation of the determinant*/
+ switch (size){
+ case 2 : out = in[0]*in[3]-in[1]*in[2];
+ break;
+ case 3 : /*regle de Sarrus*/
+ out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7]
+ -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6];
+ break;
+ default :
+
+ /*Copy the input matrix*/
+ inCopy=(int16*)malloc((unsigned int)(size*size)*sizeof(int16));
+ for (i=0;i<size*size;i++) inCopy[i]=in[i];
+
+ tmp=(int*)malloc((unsigned int)size*sizeof(int));
+ dgetrf_(&size, &size, inCopy, &size, tmp, &info);
+ out=1;
+ for (i=0;i<size;i++){
+ if (tmp[i]!=i+1) out=-out;
+ out=inCopy[i*(size+1)]*out;
+ }
+ free(tmp);
+ free(inCopy);
+ break;
+ }
+
+#else
+ int i=0, j=0, k=0;
+ int16 out=0, pivot=0;
+ int16 *inCopy=NULL;
+
+ /*Calculation of the determinant*/
+ switch (size){
+ case 2 : out = in[0]*in[3]-in[1]*in[2];
+ break;
+ case 3 : /*regle de Sarrus*/
+ out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7]
+ -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6];
+ break;
+ default :
+
+ /*Copy the input matrix*/
+ inCopy=malloc((unsigned int)(size*size)*sizeof(int16));
+ for (i=0;i<size*size;i++) inCopy[i]=in[i];
+
+ for (i=0;i<size;i++){
+ for (j=i+1;j<size;j++){
+ pivot = inCopy[i*size+j]/inCopy[i*size+i];
+ for (k=0;k<size-i;k++){
+ inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size];
+ }
+ }
+ }
+ out=1;
+ for (i=0;i<size;i++){
+ out *= inCopy[i*size+i];
+ }
+ free(inCopy);
+ break;
+
+ }
+#endif
+
+
+ return out;
+}
diff --git a/src/c/matrixOperations/determ/i8determa.c b/src/c/matrixOperations/determ/i8determa.c
new file mode 100644
index 00000000..cf436a00
--- /dev/null
+++ b/src/c/matrixOperations/determ/i8determa.c
@@ -0,0 +1,92 @@
+/* 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 <stdlib.h>
+#ifndef WITHOUT_LAPACK
+#include "lapack.h"
+#endif
+#include "determ.h"
+#include "lapack.h"
+
+int8 i8determa(int8 * in, int size){
+#ifndef WITHOUT_LAPACK
+ int i=0, info=0;
+ int8 out=0;
+ int8 *inCopy=NULL;
+ int* tmp=NULL;
+
+ /*Calculation of the determinant*/
+ switch (size){
+ case 2 : out = in[0]*in[3]-in[1]*in[2];
+ break;
+ case 3 : /*regle de Sarrus*/
+ out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7]
+ -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6];
+ break;
+ default :
+
+ /*Copy the input matrix*/
+ inCopy=(int8*)malloc((unsigned int)(size*size)*sizeof(int8));
+ for (i=0;i<size*size;i++) inCopy[i]=in[i];
+
+ tmp=(int*)malloc((unsigned int)size*sizeof(int));
+ dgetrf_(&size, &size, inCopy, &size, tmp, &info);
+ out=1;
+ for (i=0;i<size;i++){
+ if (tmp[i]!=i+1) out=-out;
+ out=inCopy[i*(size+1)]*out;
+ }
+ free(tmp);
+ free(inCopy);
+ break;
+ }
+
+#else
+ int i=0, j=0, k=0;
+ int8 out=0, pivot=0;
+ int8 *inCopy=NULL;
+
+ /*Calculation of the determinant*/
+ switch (size){
+ case 2 : out = in[0]*in[3]-in[1]*in[2];
+ break;
+ case 3 : /*regle de Sarrus*/
+ out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7]
+ -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6];
+ break;
+ default :
+
+ /*Copy the input matrix*/
+ inCopy=malloc((unsigned int)(size*size)*sizeof(int8));
+ for (i=0;i<size*size;i++) inCopy[i]=in[i];
+
+ for (i=0;i<size;i++){
+ for (j=i+1;j<size;j++){
+ pivot = inCopy[i*size+j]/inCopy[i*size+i];
+ for (k=0;k<size-i;k++){
+ inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size];
+ }
+ }
+ }
+ out=1;
+ for (i=0;i<size;i++){
+ out *= inCopy[i*size+i];
+ }
+ free(inCopy);
+ break;
+
+ }
+#endif
+
+
+ return out;
+}
diff --git a/src/c/matrixOperations/determ/u16determa.c b/src/c/matrixOperations/determ/u16determa.c
new file mode 100644
index 00000000..5e859d44
--- /dev/null
+++ b/src/c/matrixOperations/determ/u16determa.c
@@ -0,0 +1,92 @@
+/* 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 <stdlib.h>
+#ifndef WITHOUT_LAPACK
+#include "lapack.h"
+#endif
+#include "determ.h"
+#include "lapack.h"
+
+uint16 u16determa(uint16 * in, int size){
+#ifndef WITHOUT_LAPACK
+ int i=0, info=0;
+ uint16 out=0;
+ uint16 *inCopy=NULL;
+ int* tmp=NULL;
+
+ /*Calculation of the determinant*/
+ switch (size){
+ case 2 : out = in[0]*in[3]-in[1]*in[2];
+ break;
+ case 3 : /*regle de Sarrus*/
+ out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7]
+ -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6];
+ break;
+ default :
+
+ /*Copy the input matrix*/
+ inCopy=(uint16*)malloc((unsigned int)(size*size)*sizeof(uint16));
+ for (i=0;i<size*size;i++) inCopy[i]=in[i];
+
+ tmp=(int*)malloc((unsigned int)size*sizeof(int));
+ dgetrf_(&size, &size, inCopy, &size, tmp, &info);
+ out=1;
+ for (i=0;i<size;i++){
+ if (tmp[i]!=i+1) out=-out;
+ out=inCopy[i*(size+1)]*out;
+ }
+ free(tmp);
+ free(inCopy);
+ break;
+ }
+
+#else
+ int i=0, j=0, k=0;
+ uint16 out=0, pivot=0;
+ uint16 *inCopy=NULL;
+
+ /*Calculation of the determinant*/
+ switch (size){
+ case 2 : out = in[0]*in[3]-in[1]*in[2];
+ break;
+ case 3 : /*regle de Sarrus*/
+ out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7]
+ -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6];
+ break;
+ default :
+
+ /*Copy the input matrix*/
+ inCopy=malloc((unsigned int)(size*size)*sizeof(uint16));
+ for (i=0;i<size*size;i++) inCopy[i]=in[i];
+
+ for (i=0;i<size;i++){
+ for (j=i+1;j<size;j++){
+ pivot = inCopy[i*size+j]/inCopy[i*size+i];
+ for (k=0;k<size-i;k++){
+ inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size];
+ }
+ }
+ }
+ out=1;
+ for (i=0;i<size;i++){
+ out *= inCopy[i*size+i];
+ }
+ free(inCopy);
+ break;
+
+ }
+#endif
+
+
+ return out;
+}
diff --git a/src/c/matrixOperations/determ/u8determa.c b/src/c/matrixOperations/determ/u8determa.c
new file mode 100644
index 00000000..f226af20
--- /dev/null
+++ b/src/c/matrixOperations/determ/u8determa.c
@@ -0,0 +1,92 @@
+/* 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 <stdlib.h>
+#ifndef WITHOUT_LAPACK
+#include "lapack.h"
+#endif
+#include "determ.h"
+#include "lapack.h"
+
+uint8 u8determa(uint8 * in, int size){
+#ifndef WITHOUT_LAPACK
+ int i=0, info=0;
+ uint8 out=0;
+ uint8 *inCopy=NULL;
+ int* tmp=NULL;
+
+ /*Calculation of the determinant*/
+ switch (size){
+ case 2 : out = in[0]*in[3]-in[1]*in[2];
+ break;
+ case 3 : /*regle de Sarrus*/
+ out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7]
+ -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6];
+ break;
+ default :
+
+ /*Copy the input matrix*/
+ inCopy=(uint8*)malloc((unsigned int)(size*size)*sizeof(uint8));
+ for (i=0;i<size*size;i++) inCopy[i]=in[i];
+
+ tmp=(int*)malloc((unsigned int)size*sizeof(int));
+ dgetrf_(&size, &size, inCopy, &size, tmp, &info);
+ out=1;
+ for (i=0;i<size;i++){
+ if (tmp[i]!=i+1) out=-out;
+ out=inCopy[i*(size+1)]*out;
+ }
+ free(tmp);
+ free(inCopy);
+ break;
+ }
+
+#else
+ int i=0, j=0, k=0;
+ uint8 out=0, pivot=0;
+ uint8 *inCopy=NULL;
+
+ /*Calculation of the determinant*/
+ switch (size){
+ case 2 : out = in[0]*in[3]-in[1]*in[2];
+ break;
+ case 3 : /*regle de Sarrus*/
+ out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7]
+ -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6];
+ break;
+ default :
+
+ /*Copy the input matrix*/
+ inCopy=malloc((unsigned int)(size*size)*sizeof(uint8));
+ for (i=0;i<size*size;i++) inCopy[i]=in[i];
+
+ for (i=0;i<size;i++){
+ for (j=i+1;j<size;j++){
+ pivot = inCopy[i*size+j]/inCopy[i*size+i];
+ for (k=0;k<size-i;k++){
+ inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size];
+ }
+ }
+ }
+ out=1;
+ for (i=0;i<size;i++){
+ out *= inCopy[i*size+i];
+ }
+ free(inCopy);
+ break;
+
+ }
+#endif
+
+
+ return out;
+}
diff --git a/src/c/matrixOperations/diag/ddiaga.c b/src/c/matrixOperations/diag/ddiaga.c
new file mode 100644
index 00000000..983e8ff9
--- /dev/null
+++ b/src/c/matrixOperations/diag/ddiaga.c
@@ -0,0 +1,40 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void ddiaga(double in, int size,int insert_post,double *out)
+{
+
+ int i;
+
+ for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+
+ out[abs(insert_post)] = in;
+
+ }
+ else
+ {
+
+ out[(size + insert_post)*insert_post] = in;
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/ddiagexa.c b/src/c/matrixOperations/diag/ddiagexa.c
new file mode 100644
index 00000000..0e6c314c
--- /dev/null
+++ b/src/c/matrixOperations/diag/ddiagexa.c
@@ -0,0 +1,130 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void ddiagexa(double *in, int _row,int _column,int extract_post,double *out)
+{
+
+
+ int j;
+ if(_row == _column)
+ {
+ if(extract_post <= 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+ out[j] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+ else
+ {
+ for ( j = extract_post ; j < _column ; j++ )
+ {
+
+
+ out[j-extract_post] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+
+ }
+ else if(_row > _column)
+ {
+
+ if(extract_post >=0)
+ {
+
+ for(j = extract_post; j < _column;j++)
+ {
+
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+
+ }
+ else
+ {
+
+ if((abs(extract_post) <= (_row - _column)))
+ {
+ for(j = 0; j < _column ; j++)
+ {
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+ }
+ else
+ {
+
+ for(j=0; j < (_row + extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+
+
+
+ }
+
+ }
+
+ }
+ else if (_row < _column)
+ {
+
+ if(extract_post > 0)
+ {
+ if((extract_post <= (_column - _row)))
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+ else
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+
+ }
+ else
+ {
+
+
+ for(j=0;j < (_row+extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+
+
+ }
+
+
+
+ }
+
+
+ }
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/ddiagexs.c b/src/c/matrixOperations/diag/ddiagexs.c
new file mode 100644
index 00000000..4e9ca5e4
--- /dev/null
+++ b/src/c/matrixOperations/diag/ddiagexs.c
@@ -0,0 +1,53 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+double ddiagexs(double *in, int _row,int _column,int extract_post)
+{
+
+ if(_row == _column)
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1] ;
+ }
+ else
+ {
+
+ return in[(_row)*(_row-1)] ;
+
+ }
+ }
+
+ else
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1];
+
+ }
+ else
+ {
+ return in[(_row)*(_column-1)];
+
+ }
+
+
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/ddiagina.c b/src/c/matrixOperations/diag/ddiagina.c
new file mode 100644
index 00000000..243aba10
--- /dev/null
+++ b/src/c/matrixOperations/diag/ddiagina.c
@@ -0,0 +1,59 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void ddiagina(double *in, int _row,int _column,int insert_post,double *out)
+{
+
+ int i, j;
+ if(_row == 1)
+ {
+ _column = _column;
+
+ }
+ else
+ {
+ _column = _row;
+
+ }
+
+ for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+
+ out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j];
+ }
+
+ }
+ else
+ {
+ for ( j = insert_post ; j < _column+insert_post ; j++ )
+ {
+
+
+ out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ;
+
+ }
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/ddiagins.c b/src/c/matrixOperations/diag/ddiagins.c
new file mode 100644
index 00000000..09cc921e
--- /dev/null
+++ b/src/c/matrixOperations/diag/ddiagins.c
@@ -0,0 +1,37 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void ddiagins(double *in, int size,double *out)
+{
+
+ int i, j;
+ for ( i = 0 ; i < size ; i++ )
+ {
+ for ( j = 0 ; j < size ; j++ )
+ {
+ if(i==j)
+ {
+ out[(size+1)*i] = in[i] ;
+ /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix
+ i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */
+
+
+ }
+
+ }
+ }
+
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/ddiags.c b/src/c/matrixOperations/diag/ddiags.c
new file mode 100644
index 00000000..bab21867
--- /dev/null
+++ b/src/c/matrixOperations/diag/ddiags.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+double ddiags(double in)
+{
+
+ return in;
+
+}
+
diff --git a/src/c/matrixOperations/diag/i16diaga.c b/src/c/matrixOperations/diag/i16diaga.c
new file mode 100644
index 00000000..6078ada7
--- /dev/null
+++ b/src/c/matrixOperations/diag/i16diaga.c
@@ -0,0 +1,40 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void i16diaga(int16 in, int size,int insert_post,int16 *out)
+{
+
+ int i;
+
+ for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+
+ out[abs(insert_post)] = in;
+
+ }
+ else
+ {
+
+ out[(size + insert_post)*insert_post] = in;
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/i16diagexa.c b/src/c/matrixOperations/diag/i16diagexa.c
new file mode 100644
index 00000000..b51e0ae1
--- /dev/null
+++ b/src/c/matrixOperations/diag/i16diagexa.c
@@ -0,0 +1,130 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void i16diagexa(int16 *in, int _row,int _column,int extract_post,int16 *out)
+{
+
+
+ int j;
+ if(_row == _column)
+ {
+ if(extract_post <= 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+ out[j] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+ else
+ {
+ for ( j = extract_post ; j < _column ; j++ )
+ {
+
+
+ out[j-extract_post] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+
+ }
+ else if(_row > _column)
+ {
+
+ if(extract_post >=0)
+ {
+
+ for(j = extract_post; j < _column;j++)
+ {
+
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+
+ }
+ else
+ {
+
+ if((abs(extract_post) <= (_row - _column)))
+ {
+ for(j = 0; j < _column ; j++)
+ {
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+ }
+ else
+ {
+
+ for(j=0; j < (_row + extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+
+
+
+ }
+
+ }
+
+ }
+ else if (_row < _column)
+ {
+
+ if(extract_post > 0)
+ {
+ if((extract_post <= (_column - _row)))
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+ else
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+
+ }
+ else
+ {
+
+
+ for(j=0;j < (_row+extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+
+
+ }
+
+
+
+ }
+
+
+ }
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/i16diagexs.c b/src/c/matrixOperations/diag/i16diagexs.c
new file mode 100644
index 00000000..1071c504
--- /dev/null
+++ b/src/c/matrixOperations/diag/i16diagexs.c
@@ -0,0 +1,53 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+int16 i16diagexs(int16 *in, int _row,int _column,int extract_post)
+{
+
+ if(_row == _column)
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1] ;
+ }
+ else
+ {
+
+ return in[(_row)*(_row-1)] ;
+
+ }
+ }
+
+ else
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1];
+
+ }
+ else
+ {
+ return in[(_row)*(_column-1)];
+
+ }
+
+
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/i16diagina.c b/src/c/matrixOperations/diag/i16diagina.c
new file mode 100644
index 00000000..a785003e
--- /dev/null
+++ b/src/c/matrixOperations/diag/i16diagina.c
@@ -0,0 +1,58 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void i16diagina(int16 *in, int _row,int _column,int insert_post,int16 *out)
+{
+ int i, j;
+ if(_row == 1)
+ {
+ _column = _column;
+
+ }
+ else
+ {
+ _column = _row;
+
+ }
+
+ for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+
+ out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j];
+ }
+
+ }
+ else
+ {
+ for ( j = insert_post ; j < _column+insert_post ; j++ )
+ {
+
+
+ out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ;
+
+ }
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/i16diagins.c b/src/c/matrixOperations/diag/i16diagins.c
new file mode 100644
index 00000000..f7f8612d
--- /dev/null
+++ b/src/c/matrixOperations/diag/i16diagins.c
@@ -0,0 +1,37 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void i16diagins(int16 *in, int size,int16 *out)
+{
+
+ int i, j;
+ for ( i = 0 ; i < size ; i++ )
+ {
+ for ( j = 0 ; j < size ; j++ )
+ {
+ if(i==j)
+ {
+ out[(size+1)*i] = in[i] ;
+ /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix
+ i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */
+
+
+ }
+
+ }
+ }
+
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/i16diags.c b/src/c/matrixOperations/diag/i16diags.c
new file mode 100644
index 00000000..d6d89f5b
--- /dev/null
+++ b/src/c/matrixOperations/diag/i16diags.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+int16 i16diags(int16 in)
+{
+
+ return in;
+
+}
+
diff --git a/src/c/matrixOperations/diag/i8diaga.c b/src/c/matrixOperations/diag/i8diaga.c
new file mode 100644
index 00000000..d4322278
--- /dev/null
+++ b/src/c/matrixOperations/diag/i8diaga.c
@@ -0,0 +1,40 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void i8diaga(int8 in, int size,int insert_post,int8 *out)
+{
+
+ int i;
+
+ for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+
+ out[abs(insert_post)] = in;
+
+ }
+ else
+ {
+
+ out[(size + insert_post)*insert_post] = in;
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/i8diagexa.c b/src/c/matrixOperations/diag/i8diagexa.c
new file mode 100644
index 00000000..8d5513b6
--- /dev/null
+++ b/src/c/matrixOperations/diag/i8diagexa.c
@@ -0,0 +1,130 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void i8diagexa(int8 *in, int _row,int _column,int extract_post,int8 *out)
+{
+
+
+ int j;
+ if(_row == _column)
+ {
+ if(extract_post <= 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+ out[j] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+ else
+ {
+ for ( j = extract_post ; j < _column ; j++ )
+ {
+
+
+ out[j-extract_post] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+
+ }
+ else if(_row > _column)
+ {
+
+ if(extract_post >=0)
+ {
+
+ for(j = extract_post; j < _column;j++)
+ {
+
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+
+ }
+ else
+ {
+
+ if((abs(extract_post) <= (_row - _column)))
+ {
+ for(j = 0; j < _column ; j++)
+ {
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+ }
+ else
+ {
+
+ for(j=0; j < (_row + extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+
+
+
+ }
+
+ }
+
+ }
+ else if (_row < _column)
+ {
+
+ if(extract_post > 0)
+ {
+ if((extract_post <= (_column - _row)))
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+ else
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+
+ }
+ else
+ {
+
+
+ for(j=0;j < (_row+extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+
+
+ }
+
+
+
+ }
+
+
+ }
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/i8diagexs.c b/src/c/matrixOperations/diag/i8diagexs.c
new file mode 100644
index 00000000..5d936618
--- /dev/null
+++ b/src/c/matrixOperations/diag/i8diagexs.c
@@ -0,0 +1,53 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+int8 i8diagexs(int8 *in, int _row,int _column,int extract_post)
+{
+
+ if(_row == _column)
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1] ;
+ }
+ else
+ {
+
+ return in[(_row)*(_row-1)] ;
+
+ }
+ }
+
+ else
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1];
+
+ }
+ else
+ {
+ return in[(_row)*(_column-1)];
+
+ }
+
+
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/i8diagina.c b/src/c/matrixOperations/diag/i8diagina.c
new file mode 100644
index 00000000..b1bd1bac
--- /dev/null
+++ b/src/c/matrixOperations/diag/i8diagina.c
@@ -0,0 +1,58 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void i8diagina(int8 *in, int _row,int _column,int insert_post,int8 *out)
+{
+ int i, j;
+ if(_row == 1)
+ {
+ _column = _column;
+
+ }
+ else
+ {
+ _column = _row;
+
+ }
+
+ for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+
+ out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j];
+ }
+
+ }
+ else
+ {
+ for ( j = insert_post ; j < _column+insert_post ; j++ )
+ {
+
+
+ out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ;
+
+ }
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/i8diagins.c b/src/c/matrixOperations/diag/i8diagins.c
new file mode 100644
index 00000000..dc6df972
--- /dev/null
+++ b/src/c/matrixOperations/diag/i8diagins.c
@@ -0,0 +1,37 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void i8diagins(int8 *in, int size,int8 *out)
+{
+
+ int i, j;
+ for ( i = 0 ; i < size ; i++ )
+ {
+ for ( j = 0 ; j < size ; j++ )
+ {
+ if(i==j)
+ {
+ out[(size+1)*i] = in[i] ;
+ /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix
+ i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */
+
+
+ }
+
+ }
+ }
+
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/i8diags.c b/src/c/matrixOperations/diag/i8diags.c
new file mode 100644
index 00000000..55eea1b1
--- /dev/null
+++ b/src/c/matrixOperations/diag/i8diags.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+int8 i8diags(int8 in)
+{
+
+ return in;
+
+}
+
diff --git a/src/c/matrixOperations/diag/u16diaga.c b/src/c/matrixOperations/diag/u16diaga.c
new file mode 100644
index 00000000..ee27e53c
--- /dev/null
+++ b/src/c/matrixOperations/diag/u16diaga.c
@@ -0,0 +1,40 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void u16diaga(uint16 in, int size,int insert_post,uint16 *out)
+{
+
+ int i;
+
+ for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+
+ out[abs(insert_post)] = in;
+
+ }
+ else
+ {
+
+ out[(size + insert_post)*insert_post] = in;
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/u16diagexa.c b/src/c/matrixOperations/diag/u16diagexa.c
new file mode 100644
index 00000000..ac996b7b
--- /dev/null
+++ b/src/c/matrixOperations/diag/u16diagexa.c
@@ -0,0 +1,130 @@
+/* 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: Mushir
+ rganization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void u16diagexa(uint16 *in, int _row,int _column,int extract_post,uint16 *out)
+{
+
+
+ int j;
+ if(_row == _column)
+ {
+ if(extract_post <= 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+ out[j] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+ else
+ {
+ for ( j = extract_post ; j < _column ; j++ )
+ {
+
+
+ out[j-extract_post] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+
+ }
+ else if(_row > _column)
+ {
+
+ if(extract_post >=0)
+ {
+
+ for(j = extract_post; j < _column;j++)
+ {
+
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+
+ }
+ else
+ {
+
+ if((abs(extract_post) <= (_row - _column)))
+ {
+ for(j = 0; j < _column ; j++)
+ {
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+ }
+ else
+ {
+
+ for(j=0; j < (_row + extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+
+
+
+ }
+
+ }
+
+ }
+ else if (_row < _column)
+ {
+
+ if(extract_post > 0)
+ {
+ if((extract_post <= (_column - _row)))
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+ else
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+
+ }
+ else
+ {
+
+
+ for(j=0;j < (_row+extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+
+
+ }
+
+
+
+ }
+
+
+ }
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/u16diagexs.c b/src/c/matrixOperations/diag/u16diagexs.c
new file mode 100644
index 00000000..dd04c5d2
--- /dev/null
+++ b/src/c/matrixOperations/diag/u16diagexs.c
@@ -0,0 +1,53 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+uint16 u16diagexs(uint16 *in, int _row,int _column,int extract_post)
+{
+
+ if(_row == _column)
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1] ;
+ }
+ else
+ {
+
+ return in[(_row)*(_row-1)] ;
+
+ }
+ }
+
+ else
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1];
+
+ }
+ else
+ {
+ return in[(_row)*(_column-1)];
+
+ }
+
+
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/u16diagina.c b/src/c/matrixOperations/diag/u16diagina.c
new file mode 100644
index 00000000..97f5139c
--- /dev/null
+++ b/src/c/matrixOperations/diag/u16diagina.c
@@ -0,0 +1,58 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void u16diagina(uint16 *in, int _row,int _column,int insert_post,uint16 *out)
+{
+ int i, j;
+ if(_row == 1)
+ {
+ _column = _column;
+
+ }
+ else
+ {
+ _column = _row;
+
+ }
+
+ for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+
+ out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j];
+ }
+
+ }
+ else
+ {
+ for ( j = insert_post ; j < _column+insert_post ; j++ )
+ {
+
+
+ out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ;
+
+ }
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/u16diagins.c b/src/c/matrixOperations/diag/u16diagins.c
new file mode 100644
index 00000000..65590bd1
--- /dev/null
+++ b/src/c/matrixOperations/diag/u16diagins.c
@@ -0,0 +1,37 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void u16diagins(uint16 *in, int size,uint16 *out)
+{
+
+ int i, j;
+ for ( i = 0 ; i < size ; i++ )
+ {
+ for ( j = 0 ; j < size ; j++ )
+ {
+ if(i==j)
+ {
+ out[(size+1)*i] = in[i] ;
+ /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix
+ i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */
+
+
+ }
+
+ }
+ }
+
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/u16diags.c b/src/c/matrixOperations/diag/u16diags.c
new file mode 100644
index 00000000..1e9b4519
--- /dev/null
+++ b/src/c/matrixOperations/diag/u16diags.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+uint16 u16diags(uint16 in)
+{
+
+ return in;
+
+}
+
diff --git a/src/c/matrixOperations/diag/u8diaga.c b/src/c/matrixOperations/diag/u8diaga.c
new file mode 100644
index 00000000..e6641aff
--- /dev/null
+++ b/src/c/matrixOperations/diag/u8diaga.c
@@ -0,0 +1,40 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void u8diaga(uint8 in, int size,int insert_post,uint8 *out)
+{
+
+ int i;
+
+ for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+
+ out[abs(insert_post)] = in;
+
+ }
+ else
+ {
+
+ out[(size + insert_post)*insert_post] = in;
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/u8diagexa.c b/src/c/matrixOperations/diag/u8diagexa.c
new file mode 100644
index 00000000..17b873b2
--- /dev/null
+++ b/src/c/matrixOperations/diag/u8diagexa.c
@@ -0,0 +1,130 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void u8diagexa(uint8 *in, int _row,int _column,int extract_post,uint8 *out)
+{
+
+
+ int j;
+ if(_row == _column)
+ {
+ if(extract_post <= 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+ out[j] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+ else
+ {
+ for ( j = extract_post ; j < _column ; j++ )
+ {
+
+
+ out[j-extract_post] = in[((_column+1)*j)-extract_post] ;
+
+ }
+ }
+
+ }
+ else if(_row > _column)
+ {
+
+ if(extract_post >=0)
+ {
+
+ for(j = extract_post; j < _column;j++)
+ {
+
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+
+ }
+ else
+ {
+
+ if((abs(extract_post) <= (_row - _column)))
+ {
+ for(j = 0; j < _column ; j++)
+ {
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+ }
+ else
+ {
+
+ for(j=0; j < (_row + extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+ }
+
+
+
+ }
+
+ }
+
+ }
+ else if (_row < _column)
+ {
+
+ if(extract_post > 0)
+ {
+ if((extract_post <= (_column - _row)))
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+ else
+ {
+ for(j=extract_post;j < _column;j++)
+ {
+ out[j-extract_post] = in[((_row+1)*j)-extract_post];
+ }
+
+ }
+
+ }
+ else
+ {
+
+
+ for(j=0;j < (_row+extract_post);j++)
+ {
+
+ out[j] = in[((_row+1)*j)-extract_post];
+
+
+
+ }
+
+
+
+ }
+
+
+ }
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/u8diagexs.c b/src/c/matrixOperations/diag/u8diagexs.c
new file mode 100644
index 00000000..fb800fda
--- /dev/null
+++ b/src/c/matrixOperations/diag/u8diagexs.c
@@ -0,0 +1,53 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+uint8 u8diagexs(uint8 *in, int _row,int _column,int extract_post)
+{
+
+ if(_row == _column)
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1] ;
+ }
+ else
+ {
+
+ return in[(_row)*(_row-1)] ;
+
+ }
+ }
+
+ else
+ {
+
+ if(extract_post < 0)
+ {
+
+ return in[_row-1];
+
+ }
+ else
+ {
+ return in[(_row)*(_column-1)];
+
+ }
+
+
+
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/u8diagina.c b/src/c/matrixOperations/diag/u8diagina.c
new file mode 100644
index 00000000..178d0f65
--- /dev/null
+++ b/src/c/matrixOperations/diag/u8diagina.c
@@ -0,0 +1,58 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+
+void u8diagina(uint8 *in, int _row,int _column,int insert_post,uint8 *out)
+{
+ int i, j;
+ if(_row == 1)
+ {
+ _column = _column;
+
+ }
+ else
+ {
+ _column = _row;
+
+ }
+
+ for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++)
+ {
+ out[i] = 0;
+
+ }
+
+ if(insert_post < 0)
+ {
+ for ( j = 0 ; j < _column ; j++ )
+ {
+
+
+
+ out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j];
+ }
+
+ }
+ else
+ {
+ for ( j = insert_post ; j < _column+insert_post ; j++ )
+ {
+
+
+ out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ;
+
+ }
+ }
+
+}
+
diff --git a/src/c/matrixOperations/diag/u8diagins.c b/src/c/matrixOperations/diag/u8diagins.c
new file mode 100644
index 00000000..787cd644
--- /dev/null
+++ b/src/c/matrixOperations/diag/u8diagins.c
@@ -0,0 +1,37 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+void u8diagins(uint8 *in, int size,uint8 *out)
+{
+
+ int i, j;
+ for ( i = 0 ; i < size ; i++ )
+ {
+ for ( j = 0 ; j < size ; j++ )
+ {
+ if(i==j)
+ {
+ out[(size+1)*i] = in[i] ;
+ /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix
+ i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */
+
+
+ }
+
+ }
+ }
+
+
+
+}
+
diff --git a/src/c/matrixOperations/diag/u8diags.c b/src/c/matrixOperations/diag/u8diags.c
new file mode 100644
index 00000000..d3d2e468
--- /dev/null
+++ b/src/c/matrixOperations/diag/u8diags.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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "diag.h"
+uint8 u8diags(uint8 in)
+{
+
+ return in;
+
+}
+
diff --git a/src/c/matrixOperations/division/i16ldivma.c b/src/c/matrixOperations/division/i16ldivma.c
new file mode 100644
index 00000000..decb8f39
--- /dev/null
+++ b/src/c/matrixOperations/division/i16ldivma.c
@@ -0,0 +1,111 @@
+/* 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 <stdlib.h>
+#include <string.h>
+#include "matrixDivision.h"
+#include "lapack.h"
+
+void i16ldivma (int16* in1, int lines1, int columns1 ,
+ int16* in2, int lines2, int columns2 ,
+ int16* out ){
+
+
+ char cNorm = 0;
+ int iExit = 0;
+
+ /*temporary variables*/
+ int iWork = 0;
+ int iInfo = 0;
+ int iMax = 0;
+ int16 dblRcond = 0;
+
+ int16 dblEps = 0;
+ int16 dblAnorm = 0;
+
+ int16 *pAf = NULL;
+ int16 *pXb = NULL;
+ int16 *pDwork = NULL;
+
+ int *pRank = NULL;
+ int *pIpiv = NULL;
+ int *pJpvt = NULL;
+ int *pIwork = NULL;
+
+ iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2));
+
+
+ lines2 = 0 ;
+
+ /* Array allocations*/
+ pAf = (int16*)malloc(sizeof(int16) * (unsigned int) lines1 * (unsigned int) columns1);
+ pXb = (int16*)malloc(sizeof(int16) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2);
+
+ pRank = (int*)malloc(sizeof(int));
+ pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+ pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+ pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+
+
+
+ cNorm = '1';
+ pDwork = (int16*)malloc(sizeof(int16) *(unsigned int)iWork);
+ dblEps = getRelativeMachinePrecision() ;
+
+ dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork);
+ if(lines1 == columns1)
+ {
+ cNorm = 'F';
+ dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1);
+ dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo);
+ if(iInfo == 0)
+ {
+ cNorm = '1';
+ C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo);
+ if(dblRcond > sqrt(dblEps))
+ {
+ cNorm = 'N';
+ C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo);
+ cNorm = 'F';
+ C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1);
+ iExit = 1;
+ }
+ }
+
+ }
+
+ if(iExit == 0)
+ {
+ dblRcond = sqrt(dblEps);
+ cNorm = 'F';
+ iMax = max(lines1, columns1);
+ C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax);
+ memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1);
+ C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax,
+ pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo);
+
+ if(iInfo == 0)
+ {
+
+ cNorm = 'F';
+ C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1);
+ }
+ }
+
+ free(pAf);
+ free(pXb);
+ free(pRank);
+ free(pIpiv);
+ free(pJpvt);
+ free(pIwork);
+ free(pDwork);
+}
diff --git a/src/c/matrixOperations/division/i16rdivma.c b/src/c/matrixOperations/division/i16rdivma.c
new file mode 100644
index 00000000..7cdebe55
--- /dev/null
+++ b/src/c/matrixOperations/division/i16rdivma.c
@@ -0,0 +1,129 @@
+/* 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 <stdlib.h>
+#include <string.h>
+#include "matrixDivision.h"
+#include "lapack.h"
+
+void i16rdivma ( int16 * in1, int lines1, int columns1,
+ int16 * in2, int lines2, int columns2,
+ int16 * out){
+
+ char cNorm = 0;
+ int iExit = 0;
+
+ /*temporary variables*/
+ int iWork = 0;
+ int iInfo = 0;
+ int iMax = 0;
+ int16 dblRcond = 0;
+
+ int16 dblEps = 0;
+ int16 dblAnorm = 0;
+
+ int16 *pAf = NULL;
+ int16 *pAt = NULL;
+ int16 *pBt = NULL;
+ int16 *pDwork = NULL;
+
+ int *pRank = NULL;
+ int *pIpiv = NULL;
+ int *pJpvt = NULL;
+ int *pIwork = NULL;
+
+ iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1));
+
+
+ /* Array allocations*/
+ pAf = (int16*)malloc(sizeof(int16) * (unsigned int)columns2 * (unsigned int)lines2);
+ pAt = (int16*)malloc(sizeof(int16) * (unsigned int)columns2 *(unsigned int) lines2);
+ pBt = (int16*)malloc(sizeof(int16) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1);
+
+ pRank = (int*)malloc(sizeof(int));
+ pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2);
+ pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2);
+ pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2);
+
+
+ cNorm = '1';
+ pDwork = (int16*)malloc(sizeof(int16) * (unsigned int)iWork);
+ dblEps = getRelativeMachinePrecision() ;
+ dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork);
+
+ /*tranpose A and B*/
+
+ dtransposea(in2, lines2, columns2, pAt);
+ dtransposea(in1, lines1, columns2, pBt);
+
+ if(lines2 == columns2)
+ {
+ cNorm = 'F';
+ dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2);
+ dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo);
+ if(iInfo == 0)
+ {
+ cNorm = '1';
+ dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo);
+ if(dblRcond > sqrt(dblEps))
+ {
+ cNorm = 'N';
+ dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo);
+ dtransposea(pBt, columns2, lines1, out);
+ iExit = 1;
+ }
+ }
+
+ }
+
+ if(iExit == 0)
+ {
+ dblRcond = sqrt(dblEps);
+ cNorm = 'F';
+ iMax = max(lines2, columns2);
+ memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2);
+ dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax,
+ pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo);
+
+ if(iInfo == 0)
+ {
+
+
+ /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/
+
+ /*Mega caca de la mort qui tue des ours a mains nues
+ mais je ne sais pas comment le rendre "beau" :(*/
+ {
+ int i,j,ij,ji;
+ for(j = 0 ; j < lines2 ; j++)
+ {
+ for(i = 0 ; i < lines1 ; i++)
+ {
+ ij = i + j * lines1;
+ ji = j + i * max(lines2, columns2);
+ out[ij] = pBt[ji];
+ }
+ }
+ }
+ }
+ }
+
+ free(pAf);
+ free(pAt);
+ free(pBt);
+ free(pRank);
+ free(pIpiv);
+ free(pJpvt);
+ free(pIwork);
+ free(pDwork);
+
+}
+
diff --git a/src/c/matrixOperations/division/i16rdivv.c b/src/c/matrixOperations/division/i16rdivv.c
new file mode 100644
index 00000000..ebbdf580
--- /dev/null
+++ b/src/c/matrixOperations/division/i16rdivv.c
@@ -0,0 +1,24 @@
+/* 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 "matrixDivision.h"
+
+int16 i16rdivv(int16 *in1, int16 *in2, int size){
+
+ int16 out[1] = { 0.0} ;
+ i16rdivma ( in1,1 ,size ,in2 , 1 , size , out );
+
+ return out[0] ;
+}
+
+
diff --git a/src/c/matrixOperations/division/i8ldivma.c b/src/c/matrixOperations/division/i8ldivma.c
new file mode 100644
index 00000000..d7ca2fd0
--- /dev/null
+++ b/src/c/matrixOperations/division/i8ldivma.c
@@ -0,0 +1,111 @@
+/* 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 <stdlib.h>
+#include <string.h>
+#include "matrixDivision.h"
+#include "lapack.h"
+
+void i8ldivma (int8* in1, int lines1, int columns1 ,
+ int8* in2, int lines2, int columns2 ,
+ int8* out ){
+
+
+ char cNorm = 0;
+ int iExit = 0;
+
+ /*temporary variables*/
+ int iWork = 0;
+ int iInfo = 0;
+ int iMax = 0;
+ int8 dblRcond = 0;
+
+ int8 dblEps = 0;
+ int8 dblAnorm = 0;
+
+ int8 *pAf = NULL;
+ int8 *pXb = NULL;
+ int8 *pDwork = NULL;
+
+ int *pRank = NULL;
+ int *pIpiv = NULL;
+ int *pJpvt = NULL;
+ int *pIwork = NULL;
+
+ iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2));
+
+
+ lines2 = 0 ;
+
+ /* Array allocations*/
+ pAf = (int8*)malloc(sizeof(int8) * (unsigned int) lines1 * (unsigned int) columns1);
+ pXb = (int8*)malloc(sizeof(int8) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2);
+
+ pRank = (int*)malloc(sizeof(int));
+ pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+ pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+ pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+
+
+
+ cNorm = '1';
+ pDwork = (int8*)malloc(sizeof(int8) *(unsigned int)iWork);
+ dblEps = getRelativeMachinePrecision() ;
+
+ dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork);
+ if(lines1 == columns1)
+ {
+ cNorm = 'F';
+ dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1);
+ dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo);
+ if(iInfo == 0)
+ {
+ cNorm = '1';
+ C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo);
+ if(dblRcond > sqrt(dblEps))
+ {
+ cNorm = 'N';
+ C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo);
+ cNorm = 'F';
+ C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1);
+ iExit = 1;
+ }
+ }
+
+ }
+
+ if(iExit == 0)
+ {
+ dblRcond = sqrt(dblEps);
+ cNorm = 'F';
+ iMax = max(lines1, columns1);
+ C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax);
+ memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1);
+ C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax,
+ pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo);
+
+ if(iInfo == 0)
+ {
+
+ cNorm = 'F';
+ C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1);
+ }
+ }
+
+ free(pAf);
+ free(pXb);
+ free(pRank);
+ free(pIpiv);
+ free(pJpvt);
+ free(pIwork);
+ free(pDwork);
+}
diff --git a/src/c/matrixOperations/division/i8rdivma.c b/src/c/matrixOperations/division/i8rdivma.c
new file mode 100644
index 00000000..0048c036
--- /dev/null
+++ b/src/c/matrixOperations/division/i8rdivma.c
@@ -0,0 +1,129 @@
+/* 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 <stdlib.h>
+#include <string.h>
+#include "matrixDivision.h"
+#include "lapack.h"
+
+void i8rdivma ( int8 * in1, int lines1, int columns1,
+ int8 * in2, int lines2, int columns2,
+ int8 * out){
+
+ char cNorm = 0;
+ int iExit = 0;
+
+ /*temporary variables*/
+ int iWork = 0;
+ int iInfo = 0;
+ int iMax = 0;
+ int8 dblRcond = 0;
+
+ int8 dblEps = 0;
+ int8 dblAnorm = 0;
+
+ int8 *pAf = NULL;
+ int8 *pAt = NULL;
+ int8 *pBt = NULL;
+ int8 *pDwork = NULL;
+
+ int *pRank = NULL;
+ int *pIpiv = NULL;
+ int *pJpvt = NULL;
+ int *pIwork = NULL;
+
+ iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1));
+
+
+ /* Array allocations*/
+ pAf = (int8*)malloc(sizeof(int8) * (unsigned int)columns2 * (unsigned int)lines2);
+ pAt = (int8*)malloc(sizeof(int8) * (unsigned int)columns2 *(unsigned int) lines2);
+ pBt = (int8*)malloc(sizeof(int8) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1);
+
+ pRank = (int*)malloc(sizeof(int));
+ pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2);
+ pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2);
+ pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2);
+
+
+ cNorm = '1';
+ pDwork = (int8*)malloc(sizeof(int8) * (unsigned int)iWork);
+ dblEps = getRelativeMachinePrecision() ;
+ dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork);
+
+ /*tranpose A and B*/
+
+ dtransposea(in2, lines2, columns2, pAt);
+ dtransposea(in1, lines1, columns2, pBt);
+
+ if(lines2 == columns2)
+ {
+ cNorm = 'F';
+ dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2);
+ dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo);
+ if(iInfo == 0)
+ {
+ cNorm = '1';
+ dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo);
+ if(dblRcond > sqrt(dblEps))
+ {
+ cNorm = 'N';
+ dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo);
+ dtransposea(pBt, columns2, lines1, out);
+ iExit = 1;
+ }
+ }
+
+ }
+
+ if(iExit == 0)
+ {
+ dblRcond = sqrt(dblEps);
+ cNorm = 'F';
+ iMax = max(lines2, columns2);
+ memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2);
+ dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax,
+ pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo);
+
+ if(iInfo == 0)
+ {
+
+
+ /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/
+
+ /*Mega caca de la mort qui tue des ours a mains nues
+ mais je ne sais pas comment le rendre "beau" :(*/
+ {
+ int i,j,ij,ji;
+ for(j = 0 ; j < lines2 ; j++)
+ {
+ for(i = 0 ; i < lines1 ; i++)
+ {
+ ij = i + j * lines1;
+ ji = j + i * max(lines2, columns2);
+ out[ij] = pBt[ji];
+ }
+ }
+ }
+ }
+ }
+
+ free(pAf);
+ free(pAt);
+ free(pBt);
+ free(pRank);
+ free(pIpiv);
+ free(pJpvt);
+ free(pIwork);
+ free(pDwork);
+
+}
+
diff --git a/src/c/matrixOperations/division/i8rdivv.c b/src/c/matrixOperations/division/i8rdivv.c
new file mode 100644
index 00000000..7d262afa
--- /dev/null
+++ b/src/c/matrixOperations/division/i8rdivv.c
@@ -0,0 +1,24 @@
+/* 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 "matrixDivision.h"
+
+int8 i8rdivv(int8 *in1, int8 *in2, int size){
+
+ int8 out[1] = { 0.0} ;
+ i8rdivma ( in1,1 ,size ,in2 , 1 , size , out );
+
+ return out[0] ;
+}
+
+
diff --git a/src/c/matrixOperations/division/u16ldivma.c b/src/c/matrixOperations/division/u16ldivma.c
new file mode 100644
index 00000000..d7901f38
--- /dev/null
+++ b/src/c/matrixOperations/division/u16ldivma.c
@@ -0,0 +1,111 @@
+/* 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 <stdlib.h>
+#include <string.h>
+#include "matrixDivision.h"
+#include "lapack.h"
+
+void u16ldivma (uint16* in1, int lines1, int columns1 ,
+ uint16* in2, int lines2, int columns2 ,
+ uint16* out ){
+
+
+ char cNorm = 0;
+ int iExit = 0;
+
+ /*temporary variables*/
+ int iWork = 0;
+ int iInfo = 0;
+ int iMax = 0;
+ uint16 dblRcond = 0;
+
+ uint16 dblEps = 0;
+ uint16 dblAnorm = 0;
+
+ uint16 *pAf = NULL;
+ uint16 *pXb = NULL;
+ uint16 *pDwork = NULL;
+
+ int *pRank = NULL;
+ int *pIpiv = NULL;
+ int *pJpvt = NULL;
+ int *pIwork = NULL;
+
+ iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2));
+
+
+ lines2 = 0 ;
+
+ /* Array allocations*/
+ pAf = (uint16*)malloc(sizeof(uint16) * (unsigned int) lines1 * (unsigned int) columns1);
+ pXb = (uint16*)malloc(sizeof(uint16) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2);
+
+ pRank = (int*)malloc(sizeof(int));
+ pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+ pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+ pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+
+
+
+ cNorm = '1';
+ pDwork = (uint16*)malloc(sizeof(uint16) *(unsigned int)iWork);
+ dblEps = getRelativeMachinePrecision() ;
+
+ dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork);
+ if(lines1 == columns1)
+ {
+ cNorm = 'F';
+ dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1);
+ dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo);
+ if(iInfo == 0)
+ {
+ cNorm = '1';
+ C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo);
+ if(dblRcond > sqrt(dblEps))
+ {
+ cNorm = 'N';
+ C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo);
+ cNorm = 'F';
+ C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1);
+ iExit = 1;
+ }
+ }
+
+ }
+
+ if(iExit == 0)
+ {
+ dblRcond = sqrt(dblEps);
+ cNorm = 'F';
+ iMax = max(lines1, columns1);
+ C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax);
+ memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1);
+ C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax,
+ pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo);
+
+ if(iInfo == 0)
+ {
+
+ cNorm = 'F';
+ C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1);
+ }
+ }
+
+ free(pAf);
+ free(pXb);
+ free(pRank);
+ free(pIpiv);
+ free(pJpvt);
+ free(pIwork);
+ free(pDwork);
+}
diff --git a/src/c/matrixOperations/division/u16rdivma.c b/src/c/matrixOperations/division/u16rdivma.c
new file mode 100644
index 00000000..d6642074
--- /dev/null
+++ b/src/c/matrixOperations/division/u16rdivma.c
@@ -0,0 +1,129 @@
+/* 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 <stdlib.h>
+#include <string.h>
+#include "matrixDivision.h"
+#include "lapack.h"
+
+void u16rdivma ( uint16 * in1, int lines1, int columns1,
+ uint16 * in2, int lines2, int columns2,
+ uint16 * out){
+
+ char cNorm = 0;
+ int iExit = 0;
+
+ /*temporary variables*/
+ int iWork = 0;
+ int iInfo = 0;
+ int iMax = 0;
+ uint16 dblRcond = 0;
+
+ uint16 dblEps = 0;
+ uint16 dblAnorm = 0;
+
+ uint16 *pAf = NULL;
+ uint16 *pAt = NULL;
+ uint16 *pBt = NULL;
+ uint16 *pDwork = NULL;
+
+ int *pRank = NULL;
+ int *pIpiv = NULL;
+ int *pJpvt = NULL;
+ int *pIwork = NULL;
+
+ iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1));
+
+
+ /* Array allocations*/
+ pAf = (uint16*)malloc(sizeof(uint16) * (unsigned int)columns2 * (unsigned int)lines2);
+ pAt = (uint16*)malloc(sizeof(uint16) * (unsigned int)columns2 *(unsigned int) lines2);
+ pBt = (uint16*)malloc(sizeof(uint16) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1);
+
+ pRank = (int*)malloc(sizeof(int));
+ pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2);
+ pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2);
+ pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2);
+
+
+ cNorm = '1';
+ pDwork = (uint16*)malloc(sizeof(uint16) * (unsigned int)iWork);
+ dblEps = getRelativeMachinePrecision() ;
+ dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork);
+
+ /*tranpose A and B*/
+
+ dtransposea(in2, lines2, columns2, pAt);
+ dtransposea(in1, lines1, columns2, pBt);
+
+ if(lines2 == columns2)
+ {
+ cNorm = 'F';
+ dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2);
+ dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo);
+ if(iInfo == 0)
+ {
+ cNorm = '1';
+ dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo);
+ if(dblRcond > sqrt(dblEps))
+ {
+ cNorm = 'N';
+ dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo);
+ dtransposea(pBt, columns2, lines1, out);
+ iExit = 1;
+ }
+ }
+
+ }
+
+ if(iExit == 0)
+ {
+ dblRcond = sqrt(dblEps);
+ cNorm = 'F';
+ iMax = max(lines2, columns2);
+ memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2);
+ dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax,
+ pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo);
+
+ if(iInfo == 0)
+ {
+
+
+ /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/
+
+ /*Mega caca de la mort qui tue des ours a mains nues
+ mais je ne sais pas comment le rendre "beau" :(*/
+ {
+ int i,j,ij,ji;
+ for(j = 0 ; j < lines2 ; j++)
+ {
+ for(i = 0 ; i < lines1 ; i++)
+ {
+ ij = i + j * lines1;
+ ji = j + i * max(lines2, columns2);
+ out[ij] = pBt[ji];
+ }
+ }
+ }
+ }
+ }
+
+ free(pAf);
+ free(pAt);
+ free(pBt);
+ free(pRank);
+ free(pIpiv);
+ free(pJpvt);
+ free(pIwork);
+ free(pDwork);
+
+}
+
diff --git a/src/c/matrixOperations/division/u16rdivv.c b/src/c/matrixOperations/division/u16rdivv.c
new file mode 100644
index 00000000..66dc2144
--- /dev/null
+++ b/src/c/matrixOperations/division/u16rdivv.c
@@ -0,0 +1,24 @@
+/* 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 "matrixDivision.h"
+
+uint16 u16rdivv(uint16 *in1, uint16 *in2, int size){
+
+ uint16 out[1] = { 0.0} ;
+ u16rdivma ( in1,1 ,size ,in2 , 1 , size , out );
+
+ return out[0] ;
+}
+
+
diff --git a/src/c/matrixOperations/division/u8ldivma.c b/src/c/matrixOperations/division/u8ldivma.c
new file mode 100644
index 00000000..ce491b4f
--- /dev/null
+++ b/src/c/matrixOperations/division/u8ldivma.c
@@ -0,0 +1,111 @@
+/* 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 <stdlib.h>
+#include <string.h>
+#include "matrixDivision.h"
+#include "lapack.h"
+
+void u8ldivma (uint8* in1, int lines1, int columns1 ,
+ uint8* in2, int lines2, int columns2 ,
+ uint8* out ){
+
+
+ char cNorm = 0;
+ int iExit = 0;
+
+ /*temporary variables*/
+ int iWork = 0;
+ int iInfo = 0;
+ int iMax = 0;
+ uint8 dblRcond = 0;
+
+ uint8 dblEps = 0;
+ uint8 dblAnorm = 0;
+
+ uint8 *pAf = NULL;
+ uint8 *pXb = NULL;
+ uint8 *pDwork = NULL;
+
+ int *pRank = NULL;
+ int *pIpiv = NULL;
+ int *pJpvt = NULL;
+ int *pIwork = NULL;
+
+ iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2));
+
+
+ lines2 = 0 ;
+
+ /* Array allocations*/
+ pAf = (uint8*)malloc(sizeof(uint8) * (unsigned int) lines1 * (unsigned int) columns1);
+ pXb = (uint8*)malloc(sizeof(uint8) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2);
+
+ pRank = (int*)malloc(sizeof(int));
+ pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+ pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+ pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1);
+
+
+
+ cNorm = '1';
+ pDwork = (uint8*)malloc(sizeof(uint8) *(unsigned int)iWork);
+ dblEps = getRelativeMachinePrecision() ;
+
+ dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork);
+ if(lines1 == columns1)
+ {
+ cNorm = 'F';
+ dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1);
+ dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo);
+ if(iInfo == 0)
+ {
+ cNorm = '1';
+ C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo);
+ if(dblRcond > sqrt(dblEps))
+ {
+ cNorm = 'N';
+ C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo);
+ cNorm = 'F';
+ C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1);
+ iExit = 1;
+ }
+ }
+
+ }
+
+ if(iExit == 0)
+ {
+ dblRcond = sqrt(dblEps);
+ cNorm = 'F';
+ iMax = max(lines1, columns1);
+ C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax);
+ memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1);
+ C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax,
+ pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo);
+
+ if(iInfo == 0)
+ {
+
+ cNorm = 'F';
+ C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1);
+ }
+ }
+
+ free(pAf);
+ free(pXb);
+ free(pRank);
+ free(pIpiv);
+ free(pJpvt);
+ free(pIwork);
+ free(pDwork);
+}
diff --git a/src/c/matrixOperations/division/u8rdivma.c b/src/c/matrixOperations/division/u8rdivma.c
new file mode 100644
index 00000000..6ff4b17a
--- /dev/null
+++ b/src/c/matrixOperations/division/u8rdivma.c
@@ -0,0 +1,129 @@
+/* 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 <stdlib.h>
+#include <string.h>
+#include "matrixDivision.h"
+#include "lapack.h"
+
+void u8rdivma ( uint8 * in1, int lines1, int columns1,
+ uint8 * in2, int lines2, int columns2,
+ uint8 * out){
+
+ char cNorm = 0;
+ int iExit = 0;
+
+ /*temporary variables*/
+ int iWork = 0;
+ int iInfo = 0;
+ int iMax = 0;
+ uint8 dblRcond = 0;
+
+ uint8 dblEps = 0;
+ uint8 dblAnorm = 0;
+
+ uint8 *pAf = NULL;
+ uint8 *pAt = NULL;
+ uint8 *pBt = NULL;
+ uint8 *pDwork = NULL;
+
+ int *pRank = NULL;
+ int *pIpiv = NULL;
+ int *pJpvt = NULL;
+ int *pIwork = NULL;
+
+ iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1));
+
+
+ /* Array allocations*/
+ pAf = (uint8*)malloc(sizeof(uint8) * (unsigned int)columns2 * (unsigned int)lines2);
+ pAt = (uint8*)malloc(sizeof(uint8) * (unsigned int)columns2 *(unsigned int) lines2);
+ pBt = (uint8*)malloc(sizeof(uint8) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1);
+
+ pRank = (int*)malloc(sizeof(int));
+ pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2);
+ pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2);
+ pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2);
+
+
+ cNorm = '1';
+ pDwork = (uint8*)malloc(sizeof(uint8) * (unsigned int)iWork);
+ dblEps = getRelativeMachinePrecision() ;
+ dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork);
+
+ /*tranpose A and B*/
+
+ dtransposea(in2, lines2, columns2, pAt);
+ dtransposea(in1, lines1, columns2, pBt);
+
+ if(lines2 == columns2)
+ {
+ cNorm = 'F';
+ dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2);
+ dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo);
+ if(iInfo == 0)
+ {
+ cNorm = '1';
+ dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo);
+ if(dblRcond > sqrt(dblEps))
+ {
+ cNorm = 'N';
+ dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo);
+ dtransposea(pBt, columns2, lines1, out);
+ iExit = 1;
+ }
+ }
+
+ }
+
+ if(iExit == 0)
+ {
+ dblRcond = sqrt(dblEps);
+ cNorm = 'F';
+ iMax = max(lines2, columns2);
+ memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2);
+ dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax,
+ pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo);
+
+ if(iInfo == 0)
+ {
+
+
+ /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/
+
+ /*Mega caca de la mort qui tue des ours a mains nues
+ mais je ne sais pas comment le rendre "beau" :(*/
+ {
+ int i,j,ij,ji;
+ for(j = 0 ; j < lines2 ; j++)
+ {
+ for(i = 0 ; i < lines1 ; i++)
+ {
+ ij = i + j * lines1;
+ ji = j + i * max(lines2, columns2);
+ out[ij] = pBt[ji];
+ }
+ }
+ }
+ }
+ }
+
+ free(pAf);
+ free(pAt);
+ free(pBt);
+ free(pRank);
+ free(pIpiv);
+ free(pJpvt);
+ free(pIwork);
+ free(pDwork);
+
+}
+
diff --git a/src/c/matrixOperations/division/u8rdivv.c b/src/c/matrixOperations/division/u8rdivv.c
new file mode 100644
index 00000000..92e5762e
--- /dev/null
+++ b/src/c/matrixOperations/division/u8rdivv.c
@@ -0,0 +1,24 @@
+/* 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 "matrixDivision.h"
+
+uint8 u8rdivv(uint8 *in1, uint8 *in2, int size){
+
+ uint8 out[1] = { 0.0} ;
+ u8rdivma ( in1,1 ,size ,in2 , 1 , size , out );
+
+ return out[0] ;
+}
+
+
diff --git a/src/c/matrixOperations/eye/i16eyea.c b/src/c/matrixOperations/eye/i16eyea.c
new file mode 100644
index 00000000..a769061c
--- /dev/null
+++ b/src/c/matrixOperations/eye/i16eyea.c
@@ -0,0 +1,23 @@
+/* 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 "eye.h"
+
+void i16eyea(int16* in, int _iRows, int _iCols)
+{
+ int i, j ;
+
+ for ( i = 0 ; i < _iCols ; i++ )
+ for ( j = 0 ; j < _iRows ; j++ )
+ in[i*_iRows + j] = (i == j)?(int16)1:(int16)0 ;
+}
+
diff --git a/src/c/matrixOperations/eye/i8eyea.c b/src/c/matrixOperations/eye/i8eyea.c
new file mode 100644
index 00000000..d69ac052
--- /dev/null
+++ b/src/c/matrixOperations/eye/i8eyea.c
@@ -0,0 +1,23 @@
+/* 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 "eye.h"
+
+void i8eyea(int8* in, int _iRows, int _iCols)
+{
+ int i, j ;
+
+ for ( i = 0 ; i < _iCols ; i++ )
+ for ( j = 0 ; j < _iRows ; j++ )
+ in[i*_iRows + j] = (i == j)?(int8)1:(int8)0 ;
+}
+
diff --git a/src/c/matrixOperations/eye/u16eyea.c b/src/c/matrixOperations/eye/u16eyea.c
new file mode 100644
index 00000000..bb011986
--- /dev/null
+++ b/src/c/matrixOperations/eye/u16eyea.c
@@ -0,0 +1,23 @@
+/* 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 "eye.h"
+
+void u16eyea(uint16* in, int _iRows, int _iCols)
+{
+ int i, j ;
+
+ for ( i = 0 ; i < _iCols ; i++ )
+ for ( j = 0 ; j < _iRows ; j++ )
+ in[i*_iRows + j] = (i == j)?(uint16)1:(uint16)0 ;
+}
+
diff --git a/src/c/matrixOperations/eye/u8eyea.c b/src/c/matrixOperations/eye/u8eyea.c
new file mode 100644
index 00000000..018fc3c9
--- /dev/null
+++ b/src/c/matrixOperations/eye/u8eyea.c
@@ -0,0 +1,23 @@
+/* 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 "eye.h"
+
+void u8eyea(uint8* in, int _iRows, int _iCols)
+{
+ int i, j ;
+
+ for ( i = 0 ; i < _iCols ; i++ )
+ for ( j = 0 ; j < _iRows ; j++ )
+ in[i*_iRows + j] = (i == j)?(uint8)1:(uint8)0 ;
+}
+
diff --git a/src/c/matrixOperations/flipdim/dflipdima.c b/src/c/matrixOperations/flipdim/dflipdima.c
new file mode 100644
index 00000000..b510c445
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/dflipdima.c
@@ -0,0 +1,81 @@
+/* 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
+*/
+
+/*Function flips the input matrix along given dimension*/
+
+#include "flipdim.h"
+
+void dflipdima (double *in, int row, int col, int dim, int blk_size, double *out)
+{
+ int col_count = 0, row_count = 0, blk_count = 0, count = 0;
+ if(dim == 1) /*flip rows*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)];
+ }
+ }
+ }
+ else /*block size is more than 1*/
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)];
+ if(--count == 0)
+ {
+ blk_count += 1;
+ count = blk_size;
+ }
+ }
+ }
+
+ }
+ }
+ else if(dim == 2) /*flip columns*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count];
+ }
+ }
+ }
+ else
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count];
+ }
+ if(--count == 0)
+ {
+ count = blk_size;
+ blk_count += 1;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/flipdim/i16flipdima.c b/src/c/matrixOperations/flipdim/i16flipdima.c
new file mode 100644
index 00000000..eb51221f
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/i16flipdima.c
@@ -0,0 +1,81 @@
+/* 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
+*/
+
+/*Function flips the input matrix along given dimension*/
+
+#include "flipdim.h"
+
+void i16flipdima (int16 *in, int row, int col, int dim, int blk_size, int16 *out)
+{
+ int col_count = 0, row_count = 0, blk_count = 0, count = 0;
+ if(dim == 1) /*flip rows*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)];
+ }
+ }
+ }
+ else /*block size is more than 1*/
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)];
+ if(--count == 0)
+ {
+ blk_count += 1;
+ count = blk_size;
+ }
+ }
+ }
+
+ }
+ }
+ else if(dim == 2) /*flip columns*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count];
+ }
+ }
+ }
+ else
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count];
+ }
+ if(--count == 0)
+ {
+ count = blk_size;
+ blk_count += 1;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/flipdim/i8flipdima.c b/src/c/matrixOperations/flipdim/i8flipdima.c
new file mode 100644
index 00000000..1c23a5ea
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/i8flipdima.c
@@ -0,0 +1,81 @@
+/* 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
+*/
+
+/*Function flips the input matrix along given dimension*/
+
+#include "flipdim.h"
+
+void i8flipdima (int8 *in, int row, int col, int dim, int blk_size, int8 *out)
+{
+ int col_count = 0, row_count = 0, blk_count = 0, count = 0;
+ if(dim == 1) /*flip rows*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)];
+ }
+ }
+ }
+ else /*block size is more than 1*/
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)];
+ if(--count == 0)
+ {
+ blk_count += 1;
+ count = blk_size;
+ }
+ }
+ }
+
+ }
+ }
+ else if(dim == 2) /*flip columns*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count];
+ }
+ }
+ }
+ else
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count];
+ }
+ if(--count == 0)
+ {
+ count = blk_size;
+ blk_count += 1;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/flipdim/sflipdima.c b/src/c/matrixOperations/flipdim/sflipdima.c
new file mode 100644
index 00000000..85746996
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/sflipdima.c
@@ -0,0 +1,81 @@
+/* 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
+*/
+
+/*Function flips the input matrix along given dimension*/
+
+#include "flipdim.h"
+
+void sflipdima (float *in, int row, int col, int dim, int blk_size, float *out)
+{
+ int col_count = 0, row_count = 0, blk_count = 0, count = 0;
+ if(dim == 1) /*flip rows*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)];
+ }
+ }
+ }
+ else /*block size is more than 1*/
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)];
+ if(--count == 0)
+ {
+ blk_count += 1;
+ count = blk_size;
+ }
+ }
+ }
+
+ }
+ }
+ else if(dim == 2) /*flip columns*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count];
+ }
+ }
+ }
+ else
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count];
+ }
+ if(--count == 0)
+ {
+ count = blk_size;
+ blk_count += 1;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/flipdim/u16flipdima.c b/src/c/matrixOperations/flipdim/u16flipdima.c
new file mode 100644
index 00000000..3689b944
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/u16flipdima.c
@@ -0,0 +1,81 @@
+/* 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
+*/
+
+/*Function flips the input matrix along given dimension*/
+
+#include "flipdim.h"
+
+void u16flipdima (uint16 *in, int row, int col, int dim, int blk_size, uint16 *out)
+{
+ int col_count = 0, row_count = 0, blk_count = 0, count = 0;
+ if(dim == 1) /*flip rows*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)];
+ }
+ }
+ }
+ else /*block size is more than 1*/
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)];
+ if(--count == 0)
+ {
+ blk_count += 1;
+ count = blk_size;
+ }
+ }
+ }
+
+ }
+ }
+ else if(dim == 2) /*flip columns*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count];
+ }
+ }
+ }
+ else
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count];
+ }
+ if(--count == 0)
+ {
+ count = blk_size;
+ blk_count += 1;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/flipdim/u8flipdima.c b/src/c/matrixOperations/flipdim/u8flipdima.c
new file mode 100644
index 00000000..bae8c12f
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/u8flipdima.c
@@ -0,0 +1,80 @@
+/* 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
+*/
+/*Function flips the input matrix along given dimension*/
+
+#include "flipdim.h"
+
+void u8flipdima (uint8 *in, int row, int col, int dim, int blk_size, uint8 *out)
+{
+ int col_count = 0, row_count = 0, blk_count = 0, count = 0;
+ if(dim == 1) /*flip rows*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)];
+ }
+ }
+ }
+ else /*block size is more than 1*/
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)];
+ if(--count == 0)
+ {
+ blk_count += 1;
+ count = blk_size;
+ }
+ }
+ }
+
+ }
+ }
+ else if(dim == 2) /*flip columns*/
+ {
+ if(blk_size == 1)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count];
+ }
+ }
+ }
+ else
+ {
+ count = blk_size;
+ blk_count = 0;
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ for(row_count = 0; row_count< row;row_count++)
+ {
+ out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count];
+ }
+ if(--count == 0)
+ {
+ count = blk_size;
+ blk_count += 1;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/includes/cat.h b/src/c/matrixOperations/includes/cat.h
index 9f64a157..dde6b9bd 100644
--- a/src/c/matrixOperations/includes/cat.h
+++ b/src/c/matrixOperations/includes/cat.h
@@ -12,7 +12,7 @@
#ifndef __CAT_H__
#define __CAT_H__
-
+#include "types.h"
#include "dynlib_matrixoperations.h"
#include "floatComplex.h"
#include "doubleComplex.h"
@@ -98,6 +98,63 @@ EXTERN_MATOPS void ccolumncata(floatComplex *in1, int lines1, int columns1, flo
EXTERN_MATOPS void zrowcata(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, int lines2, int columns2, doubleComplex* out);
EXTERN_MATOPS void zcolumncata(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, int lines2, int columns2, doubleComplex* out);
+/*
+** \brief Concat uint8 arrays
+** \param in1 the uint8 array to process
+** \param lines1
+** \param columns1
+** \param in2 the uint8 array to process to concat
+** \param lines2
+** \param columns2
+** \param out the concatenation
+*/
+
+EXTERN_MATOPS void u8rowcata(uint8 *in1, int lines1, int columns1, uint8 *in2, int lines2, int columns2, uint8* out);
+EXTERN_MATOPS void u8columncata(uint8 *in1, int lines1, int columns1, uint8 *in2, int lines2, int columns2, uint8* out);
+
+/*
+** \brief Concat uint16 arrays
+** \param in1 the uint16 array to process
+** \param lines1
+** \param columns1
+** \param in2 the uint16 array to process to concat
+** \param lines2
+** \param columns2
+** \param out the concatenation
+*/
+
+EXTERN_MATOPS void u16rowcata(uint16 *in1, int lines1, int columns1, uint16 *in2, int lines2, int columns2, uint16* out);
+EXTERN_MATOPS void u16columncata(uint16 *in1, int lines1, int columns1, uint16 *in2, int lines2, int columns2, uint16* out);
+
+
+/*
+** \brief Concat int8 arrays
+** \param in1 the int8 array to process
+** \param lines1
+** \param columns1
+** \param in2 the int8 array to process to concat
+** \param lines2
+** \param columns2
+** \param out the concatenation
+*/
+
+EXTERN_MATOPS void i8rowcata(int8 *in1, int lines1, int columns1, int8 *in2, int lines2, int columns2, int8* out);
+EXTERN_MATOPS void i8columncata(int8 *in1, int lines1, int columns1, int8 *in2, int lines2, int columns2, int8* out);
+
+/*
+** \brief Concat int16 arrays
+** \param in1 the int16 array to process
+** \param lines1
+** \param columns1
+** \param in2 the int16 array to process to concat
+** \param lines2
+** \param columns2
+** \param out the concatenation
+*/
+
+EXTERN_MATOPS void i16rowcata(int16 *in1, int lines1, int columns1, int16 *in2, int lines2, int columns2, int16* out);
+EXTERN_MATOPS void i16columncata(int16 *in1, int lines1, int columns1, int16 *in2, int lines2, int columns2, int16* out);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/matrixOperations/includes/cross.h b/src/c/matrixOperations/includes/cross.h
new file mode 100644
index 00000000..0abd0019
--- /dev/null
+++ b/src/c/matrixOperations/includes/cross.h
@@ -0,0 +1,37 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __CROSS_H__
+#define __CROSS_H__
+#include "types.h"
+#include "doubleComplex.h"
+#include "floatComplex.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dcrossa (double* inp1, int size1_r, int size1_c, double* inp2, int size2_r, int size2_c ,double* oup);
+void zcrossa (doubleComplex* inp1, int size1_r, int size1_c, doubleComplex* inp2, int size2_r, int size2_c ,doubleComplex* oup);
+void ccrossa (floatComplex* inp1, int size1_r, int size1_c, floatComplex* inp2, int size2_r, int size2_c ,floatComplex* oup);
+void scrossa (float* inp1, int size1_r, int size1_c, float* inp2, int size2_r, int size2_c ,float* oup);
+void u8crossa (uint8* inp1, int size1_r, int size1_c, uint8* inp2, int size2_r, int size2_c ,uint8* oup);
+void u16crossa (uint16* inp1, int size1_r, int size1_c, uint16* inp2, int size2_r, int size2_c ,uint16* oup);
+void i8crossa (int8* inp1, int size1_r, int size1_c, int8* inp2, int size2_r, int size2_c ,int8* oup);
+void i16crossa (int16* inp1, int size1_r, int size1_c, int16* inp2, int size2_r, int size2_c ,int16* oup);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__CROSS_H__*/
diff --git a/src/c/matrixOperations/includes/cumprod.h b/src/c/matrixOperations/includes/cumprod.h
new file mode 100644
index 00000000..f47fd77a
--- /dev/null
+++ b/src/c/matrixOperations/includes/cumprod.h
@@ -0,0 +1,53 @@
+/* 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
+*/
+
+
+#ifndef __CUMPROD_H__
+#define __CUMPROD_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dcumproda(double *in1, int row, int column, double *out);
+void drowcumproda(double *in1, int row, int column, double *out);
+void dcolumncumproda(double *in1, int row, int column, double *out);
+
+void scumproda(float *in1, int row, int column, float *out);
+void srowcumproda(float *in1, int row, int column, float *out);
+void scolumncumproda(float *in1, int row, int column, float *out);
+
+void u8cumproda(uint8 *in1, int row, int column, uint8 *out);
+void u8rowcumproda(uint8 *in1, int row, int column, uint8 *out);
+void u8columncumproda(uint8 *in1, int row, int column, uint8 *out);
+
+void i8cumproda(int8 *in1, int row, int column, int8 *out);
+void i8rowcumproda(int8 *in1, int row, int column, int8 *out);
+void i8columncumproda(int8 *in1, int row, int column, int8 *out);
+
+void u16cumproda(uint16 *in1, int row, int column, uint16 *out);
+void u16rowcumproda(uint16 *in1, int row, int column, uint16 *out);
+void u16columncumproda(uint16 *in1, int row, int column, uint16 *out);
+
+void i16cumproda(int16 *in1, int row, int column, int16 *out);
+void i16rowcumproda(int16 *in1, int row, int column, int16 *out);
+void i16columncumproda(int16 *in1, int row, int column, int16 *out);
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__CUMPROD_H__*/
diff --git a/src/c/matrixOperations/includes/cumsum.h b/src/c/matrixOperations/includes/cumsum.h
new file mode 100644
index 00000000..24d81bdf
--- /dev/null
+++ b/src/c/matrixOperations/includes/cumsum.h
@@ -0,0 +1,53 @@
+/* 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
+*/
+
+
+#ifndef __CUMSUM_H__
+#define __CUMSUM_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dcumsuma(double *in1, int row, int column, double *out);
+void drowcumsuma(double *in1, int row, int column, double *out);
+void dcolumncumsuma(double *in1, int row, int column, double *out);
+
+void scumsuma(float *in1, int row, int column, float *out);
+void srowcumsuma(float *in1, int row, int column, float *out);
+void scolumncumsuma(float *in1, int row, int column, float *out);
+
+void u8cumsuma(uint8 *in1, int row, int column, uint8 *out);
+void u8rowcumsuma(uint8 *in1, int row, int column, uint8 *out);
+void u8columncumsuma(uint8 *in1, int row, int column, uint8 *out);
+
+void i8cumsuma(int8 *in1, int row, int column, int8 *out);
+void i8rowcumsuma(int8 *in1, int row, int column, int8 *out);
+void i8columncumsuma(int8 *in1, int row, int column, int8 *out);
+
+void u16cumsuma(uint16 *in1, int row, int column, uint16 *out);
+void u16rowcumsuma(uint16 *in1, int row, int column, uint16 *out);
+void u16columncumsuma(uint16 *in1, int row, int column, uint16 *out);
+
+void i16cumsuma(int16 *in1, int row, int column, int16 *out);
+void i16rowcumsuma(int16 *in1, int row, int column, int16 *out);
+void i16columncumsuma(int16 *in1, int row, int column, int16 *out);
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__CUMSUM_H__*/
diff --git a/src/c/matrixOperations/includes/diag.h b/src/c/matrixOperations/includes/diag.h
new file mode 100644
index 00000000..5f97923d
--- /dev/null
+++ b/src/c/matrixOperations/includes/diag.h
@@ -0,0 +1,97 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#ifndef __DIAG_H__
+#define __DIAG_H__
+
+#include "dynlib_matrixoperations.h"
+#include "types.h"
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EXTERN_MATOPS double ddiags(double in );
+
+EXTERN_MATOPS void ddiaga(double in, int size,int insert_post,double *out);
+
+EXTERN_MATOPS void ddiagina(double *in, int _row,int _column,int insert_post,double *out);
+
+EXTERN_MATOPS void ddiagins(double* in, int size, double* out );
+
+EXTERN_MATOPS void ddiagexa(double* in,int row,int column,int insert_pos,double* out);
+
+EXTERN_MATOPS double ddiagexs(double* in,int row,int column,int extract_pos);
+
+EXTERN_MATOPS uint8 u8diags(uint8 in );
+
+EXTERN_MATOPS void u8diaga(uint8 in, int size,int insert_post,uint8 *out);
+
+EXTERN_MATOPS void u8diagina(uint8 *in, int _row,int _column,int insert_post,uint8 *out);
+
+EXTERN_MATOPS void u8diagins(uint8* in, int size, uint8* out );
+
+EXTERN_MATOPS void u8diagexa(uint8* in,int row,int column,int insert_pos,uint8* out);
+
+EXTERN_MATOPS uint8 u8diagexs(uint8* in,int row,int column,int extract_pos);
+
+EXTERN_MATOPS uint16 u16diags(uint16 in );
+
+EXTERN_MATOPS void u16diaga(uint16 in, int size,int insert_post,uint16 *out);
+
+EXTERN_MATOPS void u16diagina(uint16 *in, int _row,int _column,int insert_post,uint16 *out);
+
+EXTERN_MATOPS void u16diagins(uint16* in, int size, uint16* out );
+
+EXTERN_MATOPS void u16diagexa(uint16* in,int row,int column,int insert_pos,uint16* out);
+
+EXTERN_MATOPS uint16 u16diagexs(uint16* in,int row,int column,int extract_pos);
+
+EXTERN_MATOPS int8 i8diags(int8 in );
+
+EXTERN_MATOPS void i8diaga(int8 in, int size,int insert_post,int8 *out);
+
+EXTERN_MATOPS void i8diagina(int8 *in, int _row,int _column,int insert_post,int8 *out);
+
+EXTERN_MATOPS void i8diagins(int8* in, int size, int8* out );
+
+EXTERN_MATOPS void i8diagexa(int8* in,int row,int column,int insert_pos,int8* out);
+
+EXTERN_MATOPS int8 i8diagexs(int8* in,int row,int column,int extract_pos);
+
+EXTERN_MATOPS int16 i16diags(int16 in );
+
+EXTERN_MATOPS void i16diaga(int16 in, int size,int insert_post,int16 *out);
+
+EXTERN_MATOPS void i16diagina(int16 *in, int _row,int _column,int insert_post,int16 *out);
+
+EXTERN_MATOPS void i16diagins(int16* in, int size, int16* out );
+
+EXTERN_MATOPS void i16diagexa(int16* in,int row,int column,int insert_pos,int16* out);
+
+EXTERN_MATOPS int16 i16diagexs(int16* in,int row,int column,int extract_pos);
+
+
+
+
+
+
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !__DIAG_H__ */
+
diff --git a/src/c/matrixOperations/includes/eye.h b/src/c/matrixOperations/includes/eye.h
index f7f2ef2f..95bdd797 100644
--- a/src/c/matrixOperations/includes/eye.h
+++ b/src/c/matrixOperations/includes/eye.h
@@ -16,6 +16,7 @@
#include "dynlib_matrixoperations.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "ones.h"
#ifdef __cplusplus
extern "C" {
@@ -42,6 +43,26 @@ extern "C" {
#define zeyes(in) DoubleComplex(1, 0)
/*
+** \brief create a Uint8 Eye value
+*/
+#define u8eyes(in) (uint8)1
+
+/*
+** \brief create a int8 Eye value
+*/
+#define i8eyes(in) (int8)1
+
+/*
+** \brief create a Uint16 Eye value
+*/
+#define u16eyes(in) (uint16)1
+
+/*
+** \brief create a int16 Eye value
+*/
+#define i16eyes(in) (int16)1
+
+/*
** \brief create a float Eye matrix
*/
EXTERN_MATOPS void seyea(float* in, int _iRows, int _iCols);
@@ -61,6 +82,26 @@ EXTERN_MATOPS void ceyea(floatComplex* in, int _iRows, int _iCols);
*/
EXTERN_MATOPS void zeyea(doubleComplex* in, int _iRows, int _iCols);
+/*
+** \brief create a uint8 Eye matrix
+*/
+EXTERN_MATOPS void u8eyea(uint8* in, int _iRows, int _iCols);
+
+/*
+** \brief create a int8 Eye matrix
+*/
+EXTERN_MATOPS void i8eyea(int8* in, int _iRows, int _iCols);
+
+/*
+** \brief create a uint16 Eye matrix
+*/
+EXTERN_MATOPS void u16eyea(uint16* in, int _iRows, int _iCols);
+
+/*
+** \brief create a int16 Eye matrix
+*/
+EXTERN_MATOPS void i16eyea(int16* in, int _iRows, int _iCols);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/matrixOperations/includes/flipdim.h b/src/c/matrixOperations/includes/flipdim.h
new file mode 100644
index 00000000..bdf4a688
--- /dev/null
+++ b/src/c/matrixOperations/includes/flipdim.h
@@ -0,0 +1,40 @@
+/* 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
+*/
+
+
+#ifndef __FLIPDIM_H__
+#define __FLIPDIM_H__
+
+#include "types.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dflipdima (double *in, int row, int col, int dim, int blk_size, double *out);
+
+void sflipdima (float *in, int row, int col, int dim, int blk_size, float *out);
+
+void u8flipdima (uint8 *in, int row, int col, int dim, int blk_size, uint8 *out);
+
+void i8flipdima (int8 *in, int row, int col, int dim, int blk_size, int8 *out);
+
+void u16flipdima (uint16 *in, int row, int col, int dim, int blk_size, uint16 *out);
+
+void i16flipdima (int16 *in, int row, int col, int dim, int blk_size, int16 *out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__FLIPDIM_H__*/
diff --git a/src/c/matrixOperations/includes/kron.h b/src/c/matrixOperations/includes/kron.h
new file mode 100644
index 00000000..e4cff2dc
--- /dev/null
+++ b/src/c/matrixOperations/includes/kron.h
@@ -0,0 +1,32 @@
+/* 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
+*/
+
+
+#ifndef __KRON_H__
+#define __KRON_H__
+
+#include "kron.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dkrona (double *in1, int row1, int col1, double *in2, int row2, \
+ int col2, double *out);
+void skrona (float *in1, int row1, int col1, float *in2, int row2, \
+ int col2, float *out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__KRON_H__*/
diff --git a/src/c/matrixOperations/includes/matrix.h b/src/c/matrixOperations/includes/matrix.h
new file mode 100644
index 00000000..582fd221
--- /dev/null
+++ b/src/c/matrixOperations/includes/matrix.h
@@ -0,0 +1,36 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#ifndef __MATRIX_H__
+#define __MATRIX_H__
+
+#include "types.h"
+#include "doubleComplex.h"
+#include "uint16.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dmatrixa(double* , int , int , int , int , double*);
+void smatrixa( float* , int , int , int , int , float*);
+void u16matrixa(uint16 *, int , int , int , int ,uint16 *out);
+void zmatrixa(doubleComplex *, int , int , int , int ,doubleComplex *);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__MATRIX_H__*/
diff --git a/src/c/matrixOperations/includes/matrixInversion.h b/src/c/matrixOperations/includes/matrixInversion.h
index 90312459..e547bb97 100644
--- a/src/c/matrixOperations/includes/matrixInversion.h
+++ b/src/c/matrixOperations/includes/matrixInversion.h
@@ -16,6 +16,7 @@
#include "abs.h"
#include "dynlib_matrixoperations.h"
+#include "types.h"
#ifdef __cplusplus
extern "C" {
@@ -59,6 +60,43 @@ EXTERN_MATOPS void cinverma ( floatComplex* in, floatComplex* out, int leadDimIn
EXTERN_MATOPS void zinverma ( doubleComplex* in, doubleComplex* out, int leadDimIn );
+/*
+** \brief Compute the matrix inverse for uint8.
+** \param in : input matrix.
+** \param leadDimIn : the leading dimension of the matrix .
+** \param out : the matrix inverse of the input .
+*/
+
+EXTERN_MATOPS void u8inverma ( uint8* in, float* out, int leadDimIn );
+
+/*
+** \brief Compute the matrix inverse for int8.
+** \param in : input matrix.
+** \param leadDimIn : the leading dimension of the matrix .
+** \param out : the matrix inverse of the input .
+*/
+
+EXTERN_MATOPS void i8inverma ( int8* in, float* out, int leadDimIn );
+
+/*
+** \brief Compute the matrix inverse for uint16.
+** \param in : input matrix.
+** \param leadDimIn : the leading dimension of the matrix .
+** \param out : the matrix inverse of the input .
+*/
+
+EXTERN_MATOPS void u16inverma ( uint16* in, float* out, int leadDimIn );
+
+/*
+** \brief Compute the matrix inverse for int16.
+** \param in : input matrix.
+** \param leadDimIn : the leading dimension of the matrix .
+** \param out : the matrix inverse of the input .
+*/
+
+EXTERN_MATOPS void i16inverma ( int16* in, float* out, int leadDimIn );
+
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/matrixOperations/includes/matrixMagnitude.h b/src/c/matrixOperations/includes/matrixMagnitude.h
index 7b65c6d9..a9f4e71c 100644
--- a/src/c/matrixOperations/includes/matrixMagnitude.h
+++ b/src/c/matrixOperations/includes/matrixMagnitude.h
@@ -17,6 +17,7 @@
#include "dynlib_matrixoperations.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "types.h"
#ifdef __cplusplus
extern "C" {
@@ -34,6 +35,18 @@ EXTERN_MATOPS float cmagna(floatComplex* in, int rows, int cols);
EXTERN_MATOPS double zmagns(doubleComplex in);
EXTERN_MATOPS double zmagna(doubleComplex* in, int rows, int cols);
+EXTERN_MATOPS uint8 u8magns(uint8 in);
+EXTERN_MATOPS uint8 u8magna(uint8* in, int rows, int cols);
+
+EXTERN_MATOPS uint16 u16magns(uint16 in);
+EXTERN_MATOPS uint16 u16magna(uint16* in, int rows, int cols);
+
+EXTERN_MATOPS int8 i8magns(int8 in);
+EXTERN_MATOPS int8 i8magna(int8* in, int rows, int cols);
+
+EXTERN_MATOPS int16 i16magns(int16 in);
+EXTERN_MATOPS int16 i16magna(int16* in, int rows, int cols);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/matrixOperations/includes/matrixMultiplication.h b/src/c/matrixOperations/includes/matrixMultiplication.h
index 228dd163..c2235c8b 100644
--- a/src/c/matrixOperations/includes/matrixMultiplication.h
+++ b/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/src/c/matrixOperations/includes/matrixTrace.h b/src/c/matrixOperations/includes/matrixTrace.h
index 76b77454..80f895df 100644
--- a/src/c/matrixOperations/includes/matrixTrace.h
+++ b/src/c/matrixOperations/includes/matrixTrace.h
@@ -16,6 +16,7 @@
#include "dynlib_matrixoperations.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "types.h"
#ifdef __cplusplus
extern "C" {
@@ -63,6 +64,44 @@ EXTERN_MATOPS floatComplex ctracea ( floatComplex* in ,int lines ) ;
*/
EXTERN_MATOPS doubleComplex ztracea ( doubleComplex* in ,int lines ) ;
+
+/*
+** \brief Compute the trace of a uint8 matrix.
+** \param in : input array.
+** \param lines : number of lines
+** \param out : uint8 containing the trace.
+*/
+EXTERN_MATOPS uint8 u8tracea ( uint8* in ,int lines ) ;
+
+
+/*
+** \brief Compute the trace of a uint16 matrix.
+** \param in : input array.
+** \param lines : number of lines
+** \param out : uint16 containing the trace.
+*/
+EXTERN_MATOPS uint16 u16tracea ( uint16* in ,int lines ) ;
+
+
+/*
+** \brief Compute the trace of a int8 matrix.
+** \param in : input array.
+** \param lines : number of lines
+** \param out : int8 containing the trace.
+*/
+EXTERN_MATOPS int8 i8tracea ( int8* in ,int lines ) ;
+
+
+/*
+** \brief Compute the trace of a int16 matrix.
+** \param in : input array.
+** \param lines : number of lines
+** \param out : int16 containing the trace.
+*/
+EXTERN_MATOPS int16 i16tracea ( int16* in ,int lines ) ;
+
+
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/matrixOperations/includes/matrixTranspose.h b/src/c/matrixOperations/includes/matrixTranspose.h
index 122b618d..7e2acbf1 100644
--- a/src/c/matrixOperations/includes/matrixTranspose.h
+++ b/src/c/matrixOperations/includes/matrixTranspose.h
@@ -16,6 +16,7 @@
#include "dynlib_matrixoperations.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "types.h"
#include <math.h>
#ifdef __cplusplus
@@ -54,6 +55,45 @@ EXTERN_MATOPS void ctransposea ( floatComplex* in , int lines1 , int column1, fl
*/
EXTERN_MATOPS void ztransposea ( doubleComplex* in , int lines1 , int column1, doubleComplex* out );
+
+/*
+** \brief Compute the transpose of a uint8 matrix.
+** \param in : input matrix.
+** \param lines1 : number of lines
+** \param column1 : number of column1
+** \param out : the transposed uint8 matrix.
+*/
+EXTERN_MATOPS void u8transposea ( uint8* in , int lines1 , int column1, uint8* out );
+
+/*
+** \brief Compute the transpose of a uint16 matrix.
+** \param in : input matrix.
+** \param lines1 : number of lines
+** \param column1 : number of column1
+** \param out : the transposed uint16 matrix.
+*/
+EXTERN_MATOPS void u16transposea ( uint16* in , int lines1 , int column1, uint16* out );
+
+/*
+** \brief Compute the transpose of a int8 matrix.
+** \param in : input matrix.
+** \param lines1 : number of lines
+** \param column1 : number of column1
+** \param out : the transposed int8 matrix.
+*/
+EXTERN_MATOPS void i8transposea ( int8* in , int lines1 , int column1, int8* out );
+
+/*
+** \brief Compute the transpose of a int16 matrix.
+** \param in : input matrix.
+** \param lines1 : number of lines
+** \param column1 : number of column1
+** \param out : the transposed int16 matrix.
+*/
+EXTERN_MATOPS void i16transposea ( int16* in , int lines1 , int column1, int16* out );
+
+
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/matrixOperations/includes/ndgrid.h b/src/c/matrixOperations/includes/ndgrid.h
new file mode 100644
index 00000000..2c6f9cfb
--- /dev/null
+++ b/src/c/matrixOperations/includes/ndgrid.h
@@ -0,0 +1,31 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __NDGRID_H__
+#define __NDGRID_H__
+#include "types.h"
+#include "doubleComplex.h"
+#include "floatComplex.h"
+#include "ndgrid.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dndgrida(double* inp1, int size1, double* inp2, int size2, double* out1, double* out2);
+void sndgrida(float* inp1, int size1, float* inp2, int size2, float* out1, float* out2);
+void zndgrida(doubleComplex* inp1, int size1, doubleComplex* inp2, int size2, doubleComplex* out1, doubleComplex* out2);
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__NDGRID_H__*/
diff --git a/src/c/matrixOperations/includes/nnz.h b/src/c/matrixOperations/includes/nnz.h
new file mode 100644
index 00000000..c7d2d491
--- /dev/null
+++ b/src/c/matrixOperations/includes/nnz.h
@@ -0,0 +1,37 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#ifndef __NNZ_H__
+#define __NNZ_H__
+
+#include "types.h"
+#include "doubleComplex.h"
+#include "uint16.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint16 dnnza(double* , int , int);
+uint16 dnnzs(double);
+uint16 snnza( float* , int , int);
+uint16 snnzs( float);
+uint16 znnza(doubleComplex *, int , int);
+uint16 znnzs(doubleComplex);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__NNZ_H__*/
diff --git a/src/c/matrixOperations/includes/norm.h b/src/c/matrixOperations/includes/norm.h
new file mode 100644
index 00000000..4fe3872c
--- /dev/null
+++ b/src/c/matrixOperations/includes/norm.h
@@ -0,0 +1,32 @@
+ /* 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: Sandeep Gupta
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __NORM_H__
+#define __NORM_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double dnormv (double *in, int size, int norm);
+
+double dnorma (double *in, int row, int col, int norm);
+
+float snormv (float *in, int size, int norm);
+
+float snorma (float *in, int row, int col, int norm);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__NORM_H__*/
diff --git a/src/c/matrixOperations/includes/ones.h b/src/c/matrixOperations/includes/ones.h
index 63d8bd4b..6734017d 100644
--- a/src/c/matrixOperations/includes/ones.h
+++ b/src/c/matrixOperations/includes/ones.h
@@ -17,6 +17,7 @@
#include "dynlib_matrixoperations.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "types.h"
#ifdef __cplusplus
@@ -43,25 +44,67 @@ extern "C" {
*/
#define zoness(in) DoubleComplex(1, 0)
+/*
+** \brief create a uint8 one value
+*/
+#define u8oness(in) (uint8)1
+
+/*
+** \brief create a int8 one value
+*/
+#define i8oness(in) (int8)1
+
+/*
+** \brief create a uint16 one value
+*/
+#define u16oness(in) (uint16)1
+
+/*
+** \brief create a int16 one value
+*/
+#define i16oness(in) (int16)1
/*
** \brief create a float matrix full of one
*/
EXTERN_MATOPS void sonesa ( float* in , int rows , int cols );
+
/*
** \brief create a float complex matrix full of one
*/
EXTERN_MATOPS void conesa ( floatComplex* in , int rows ,int cols );
+
/*
** \brief create a double matrix full of one
*/
EXTERN_MATOPS void donesa ( double* in , int rows ,int cols );
+
/*
** \brief create a double complex matrix full of one
*/
EXTERN_MATOPS void zonesa ( doubleComplex* in , int rows ,int cols );
+/*
+** \brief create a uint8 matrix full of one
+*/
+EXTERN_MATOPS void u8onesa ( uint8* in , int rows , int cols );
+
+/*
+** \brief create a int8 matrix full of one
+*/
+EXTERN_MATOPS void i8onesa ( int8* in , int rows , int cols );
+
+/*
+** \brief create a uint16 matrix full of one
+*/
+EXTERN_MATOPS void u16onesa ( uint16* in , int rows , int cols );
+
+/*
+** \brief create a int16 matrix full of one
+*/
+EXTERN_MATOPS void i16onesa ( int16* in , int rows , int cols );
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/matrixOperations/includes/pertrans.h b/src/c/matrixOperations/includes/pertrans.h
new file mode 100644
index 00000000..2c385ace
--- /dev/null
+++ b/src/c/matrixOperations/includes/pertrans.h
@@ -0,0 +1,38 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#ifndef __PERTRANS_H__
+#define __PERTRANS_H__
+
+#include "types.h"
+#include "doubleComplex.h"
+#include "uint16.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dpertransa(double *in, int row, int col, double* out);
+double dpertranss(double in);
+
+void spertransa(float *in, int row, int col, float* out);
+float spertranss(float in);
+
+void zpertransa(doubleComplex *in, int row, int col, doubleComplex* out);
+doubleComplex zpertranss(doubleComplex in);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__PERTRANS_H__*/
diff --git a/src/c/matrixOperations/includes/toeplitz.h b/src/c/matrixOperations/includes/toeplitz.h
new file mode 100644
index 00000000..7384b43c
--- /dev/null
+++ b/src/c/matrixOperations/includes/toeplitz.h
@@ -0,0 +1,37 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __TOEPLITZ_H__
+#define __TOEPLITZ_H__
+#include "types.h"
+#include "doubleComplex.h"
+#include "floatComplex.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dtoeplitza(double* inp1,int size1,double* inp2,int size2,double* oup);
+void u8toeplitza(uint8* inp1,int size1,uint8* inp2,int size2,uint8* oup);
+void u16toeplitza(uint16* inp1,int size1,uint16* inp2,int size2,uint16* oup);
+void ztoeplitza(doubleComplex* inp1,int size1,doubleComplex* inp2,int size2,doubleComplex* oup);
+void gtoeplitza(char* inp1,int size1,char* inp2,int size2,char* oup);
+void stoeplitza(float* inp1,int size1,float* inp2,int size2,float* oup);
+void ctoeplitza(floatComplex* inp1,int size1,floatComplex* inp2,int size2,floatComplex* oup);
+void i8toeplitza(int8* inp1,int size1,int8* inp2,int size2,int8* oup);
+void i16toeplitza(int16* inp1,int size1,int16* inp2,int size2,int16* oup);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__TOEPLITZ_H__*/
diff --git a/src/c/matrixOperations/includes/tril.h b/src/c/matrixOperations/includes/tril.h
new file mode 100644
index 00000000..486e81f9
--- /dev/null
+++ b/src/c/matrixOperations/includes/tril.h
@@ -0,0 +1,34 @@
+/* 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
+*/
+
+
+#ifndef __TRIL_H__
+#define __TRIL_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dtrila (double *in, int row, int column, double diag, double *out);
+void strila (float *in, int row, int column, double diag, float *out);
+void u8trila (uint8 *in, int row, int column, double diag, uint8 *out);
+void u16trila (uint16 *in, int row, int column, double diag, uint16 *out);
+void i8trila (int8 *in, int row, int column, double diag, int8 *out);
+void i16trila (int16 *in, int row, int column, double diag, int16 *out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__TRIL_H__*/
diff --git a/src/c/matrixOperations/includes/triu.h b/src/c/matrixOperations/includes/triu.h
new file mode 100644
index 00000000..2b62e22b
--- /dev/null
+++ b/src/c/matrixOperations/includes/triu.h
@@ -0,0 +1,34 @@
+/* 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
+*/
+
+
+#ifndef __TRIU_H__
+#define __TRIU_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dtriua (double *in, int row, int column, double diag, double *out);
+void striua (float *in, int row, int column, double diag, float *out);
+void u8triua (uint8 *in, int row, int column, double diag, uint8 *out);
+void u16triua (uint16 *in, int row, int column, double diag, uint16 *out);
+void i8triua (int8 *in, int row, int column, double diag, int8 *out);
+void i16triua (int16 *in, int row, int column, double diag, int16 *out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__TRIU_H__*/
diff --git a/src/c/matrixOperations/includes/zeros.h b/src/c/matrixOperations/includes/zeros.h
index 06b2e5a5..993940fc 100644
--- a/src/c/matrixOperations/includes/zeros.h
+++ b/src/c/matrixOperations/includes/zeros.h
@@ -17,6 +17,7 @@
#include "dynlib_matrixoperations.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "types.h"
#ifdef __cplusplus
extern "C" {
@@ -43,6 +44,25 @@ extern "C" {
#define zzeross(in) DoubleComplex(0, 0)
+/*
+** \brief create a single uint8 zero
+*/
+#define u8zerosu8(in) (uint8)0
+
+/*
+** \brief create a single int8 zero
+*/
+#define i8zerosi8(in) (int8)0
+
+/*
+** \brief create a single uint8 zero
+*/
+#define u16zerosu16(in) (uint16)0
+
+/*
+** \brief create a single int8 zero
+*/
+#define i16zerosi16(in) (int16)0
/*
** \brief create a float matrix full of one
@@ -66,6 +86,26 @@ EXTERN_MATOPS void zzerosa ( doubleComplex* in , int rows ,int cols );
*/
EXTERN_MATOPS void dzerosh ( double* in , int rows ,int cols , int levels);
+/*
+** \brief create a uint8 matrix full of zero
+*/
+EXTERN_MATOPS void u8zerosa ( uint8* in , int rows , int cols );
+
+/*
+** \brief create a int8 matrix full of zero
+*/
+EXTERN_MATOPS void i8zerosa ( int8* in , int rows , int cols );
+
+/*
+** \brief create a uint16 matrix full of zero
+*/
+EXTERN_MATOPS void u16zerosa ( uint16* in , int rows , int cols );
+
+/*
+** \brief create a int16 matrix full of zero
+*/
+EXTERN_MATOPS void i16zerosa ( int16* in , int rows , int cols );
+
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/matrixOperations/interfaces/int_OpStar.h b/src/c/matrixOperations/interfaces/int_OpStar.h
index 400918a4..f922b319 100644
--- a/src/c/matrixOperations/interfaces/int_OpStar.h
+++ b/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/src/c/matrixOperations/interfaces/int_cat.h b/src/c/matrixOperations/interfaces/int_cat.h
new file mode 100644
index 00000000..db80bec9
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_cat.h
@@ -0,0 +1,359 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#ifndef __INT_CAT_H
+#define __INT_CAT_H
+
+/* Column Cat */
+
+/* Same input elements */
+
+#define s0s0cats2(in1,in2,out) scolumncats(in1,in2,out)
+
+#define d0d0catd2(in1,in2,out) dcolumncats(in1,in2,out)
+
+#define c0c0catc2(in1,in2,out) ccolumncats(in1,in2,out)
+
+#define z0z0catz2(in1,in2,out) zcolumncats(in1,in2,out)
+
+#define u80u80catu82(in1,in2,out) u8columncats(in1,in2,out)
+
+#define u160u160catu162(in1,in2,out) u16columncats(in1,in2,out)
+
+#define i80i80cati82(in1,in2,out) i8columnscats(in1,in2,out)
+
+#define i160i160cati162(in1,in2,out) i16columnscats(in1,in2,out)
+
+#define s2s2cats2(in1,size1,in2,size2,out) scolumncata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define d2d2catd2(in1,size1,in2,size2,out) dcolumncata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+/* ROW COLUMN SUPPORT for cat, If First argument in cat command is 1 then it will concatenate the element ROW WISE else COLUMN WISE */
+
+#define d0d2d2catd2(in1,in2,size2,in3,size3,out) (in1 == 1) ? drowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : dcolumncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out)
+
+#define d0u82u82catu82(in1,in2,size2,in3,size3,out) (in1 == 1) ? u8rowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : u8columncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out)
+
+#define d0u162u162catu162(in1,in2,size2,in3,size3,out) (in1 == 1) ? u16rowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : u16columncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out)
+
+
+#define d0i82i82cati82(in1,in2,size2,in3,size3,out) (in1 == 1) ? i8rowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : i8columncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out)
+
+#define d0i162i162cati162(in1,in2,size2,in3,size3,out) (in1 == 1) ? i16rowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : i16columncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out)
+
+
+#define c2c2catc2(in1,size1,in2,size2,out) ccolumncata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define z2z2catz2(in1,size1,in2,size2,out) zcolumncata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define u82u82catu82(in1,size1,in2,size2,out) u8columncata(in1,size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define u162u162catu162(in1,size1,in2,size2,out) u16columncata(in1,size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define i82i82cati82(in1,size1,in2,size2,out) i8columncata(in1,size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define i162i162cati162(in1,size1,in2,size2,out) i16columncata(in1,size1[0], size1[1], in2, size2[0], size2[1], out)
+
+
+
+/* Differents input elements */
+#define s0c0catc2(in1,in2,out) c0c0OpRcc2(FloatComplex(in1,0),in2,out)
+
+#define d0z0catz2(in1,in2,out) z0z0OpRcz2(DoubleComplex(in1,0),in2,out)
+
+#define c0s0catc2(in1,in2,out) c0c0OpRcc2(in1,FloatComplex(in2,0),out)
+
+#define z0d0catz2(in1,in2,out) z0z0OpRcz2(in1,DoubleComplex(in2,0),out)
+
+#define s2c2catc2(in1,size1,in2,size2,out) sfilla((float*)out,size1[0],size1[1],0); \
+ c2c2OpRcc2(FloatComplexMatrix(in1,(float*)out,size1[0]*size1[1]), size1, in2, size2, out)
+
+#define d2z2catz2(in1,size1,in2,size2,out) dfilla((double*)out,size1[0],size1[1],0); \
+ z2z2OpRcz2(DoubleComplexMatrix(in1,(double*)out,size1[0]*size1[1]), size1, in2, size2, out)
+
+#define c2s2catc2(in1,size1,in2,size2,out) sfilla((float*)out,size2[0],size2[1],0); \
+ c2c2OpRcc2(in1, size1, FloatComplexMatrix(in2,(float*)out,size2[0]*size2[1]), size2, out)
+
+#define z2d2catz2(in1,size1,in2,size2,out) dfilla((double*)out,size2[0],size2[1],0); \
+ z2z2OpRcz2(in1, size1, DoubleComplexMatrix(in2,(double*)out,size2[0]*size2[1]), size2, out)
+
+/* Matrix-Scalar */
+
+/* Same type */
+
+#define s2s0cats2(in1,size,in2,out) { float temp=in2; \
+ scolumncata(in1, size[0], size[1],&temp, 1, 1, out); \
+ }
+
+#define d2d0catd2(in1,size,in2,out) { double temp=in2; \
+ dcolumncata(in1, size[0], size[1],&temp, 1, 1, out); \
+ }
+
+#define c2c0catc2(in1,size,in2,out) { floatComplex temp=in2; \
+ ccolumncata(in1, size[0], size[1], &temp, 1, 1, out); \
+ }
+
+#define z2z0catz2(in1,size,in2,out) { doubleComplex temp=in2; \
+ zcolumncata(in1, size[0], size[1], &temp, 1, 1, out); \
+ }
+
+#define u82u80catu82(in1,size,in2,out) { uint8 temp=in2; \
+ u8columncata(in1,size[0],size[1],&temp,1,1,out); \
+ }
+#define u162u160catu162(in1,size,in2,out) { uint16 temp=in2; \
+ u16columncata(in1,size[0],size[1],&temp,1,1,out); \
+ }
+#define i82i80cati82(in1,size,in2,out) { int8 temp=in2; \
+ i8columncata(in1,size[0],size[1],&temp,1,1,out); \
+ }
+#define i162i160cati162(in1,size,in2,out) { int16 temp=in2; \
+ i16columncata(in1,size[0],size[1],&temp,1,1,out); \
+ }
+
+
+/* Different type */
+#define s2c0catc2(in1,size,in2,out) { floatComplex temp=in2; \
+ sfilla((float *)out,size[0],size[1],0); \
+ scolumncata(FloatComplexMatrix(in1,(float*)out,size[0]*size[1]), size[0], size[1], &temp , 1, 1, out); \
+ }
+
+#define d2z0catz2(in1,size,in2,out) { doubleComplex temp=in2; \
+ dfilla((double *)out,size[0],size[1],0); \
+ zcolumncata(DoubleComplexMatrix(in1,(double *)out,size[0]*size[1]), size[0], size[1], &temp , 1, 1, out); \
+ }
+
+#define c2s0catc2(in1,size,in2,out) { floatComplex temp = FloatComplex(in2,0); \
+ ccolumncata(in1, size[0], size[1], &temp, 1, 1, out); \
+ }
+
+#define z2d0catz2(in1,size,in2,out) { doubleComplex temp = DoubleComplex(in2,0); \
+ zcolumncata(in1, size[0], size[1], &temp, 1, 1, out); \
+ }
+
+/* Scalar-Matrix */
+
+/* Same type */
+#define s0s2cats2(in1,in2,size,out) { \
+ float __tmp1 = in1 ;\
+ scolumncata(&__tmp1 , 1, 1, in2, size[0], size[1], out);\
+}
+#define d0d2catd2(in1,in2,size,out) {\
+ double __tmp1 = in1 ;\
+ dcolumncata(&__tmp1 , 1, 1, in2, size[0], size[1], out); \
+}
+
+#define c0c2catc2(in1,in2,size,out) { \
+ floatComplex __tmp1 = in1 ;\
+ ccolumncata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define z0z2catz2(in1,in2,size,out) { \
+ doubleComplex __tmp1 = in1 ;\
+ zcolumncata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define u80u82catu82(in1,in2,size,out) {\
+ uint8 __tmp1 = in1 ;\
+ u8columncata(&__tmp1,1,1,in2,size[0],size[1],out);\
+}
+
+#define u160u162catu162(in1,in2,size,out) {\
+ uint16 __tmp1 = in1 ;\
+ u16columncata(&__tmp1,1,1,in2,size[0],size[1],out);\
+}
+
+#define i80i82cati82(in1,in2,size,out) {\
+ int8 __tmp1 = in1 ;\
+ i8columncata(&__tmp1,1,1,in2,size[0],size[1],out);\
+}
+
+#define i160i162cati162(in1,in2,size,out) {\
+ int16 __tmp1 = in1 ;\
+ i16columncata(&__tmp1,1,1,in2,size[0],size[1],out);\
+}
+
+
+/* Different type */
+#define s0c2catc2(in1,in2,size,out) c0c2OpRcc2(FloatComplex(in1,0),in2,size,out)
+
+#define d0z2catz2(in1,in2,size,out) z0z2OpRcz2(DoubleComplex(in1,0),in2,size,out)
+
+#define c0s2catc2(in1,in2,size,out) sfilla((float*)out,size[0],size[1],0); \
+ c0c2OpRcc2(in1,FloatComplexMatrix(in2,(float*)out,size[0]*size[1]),size,out)
+
+#define z0d2catz2(in1,in2,size,out) dfilla((double*)out,size[0],size[1],0); \
+ z0z2OpRcz2(in1,DoubleComplexMatrix(in2,(double*)out,size[0]*size[1]),size,out)
+
+
+/* Column Cat */
+
+/* Same input elements */
+
+#define s0s0cats2(in1,in2,out) srowcats(in1,in2,out)
+
+#define d0d0catd2(in1,in2,out) drowcats(in1,in2,out)
+
+#define c0c0catc2(in1,in2,out) crowcats(in1,in2,out)
+
+#define z0z0catz2(in1,in2,out) zrowcats(in1,in2,out)
+
+#define u80u80catu82(in1,in2,out) u8rowcats(in1,in2,out)
+
+#define u160u160catu162(in1,in2,out) u16rowcats(in1,in2,out)
+
+#define i80i80cati82(in1,in2,out) i8rowcats(in1,in2,out)
+
+#define i160i160cati162(in1,in2,out) i16rowcats(in1,in2,out)
+
+#define s2s2cats2(in1,size1,in2,size2,out) srowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define d2d2catd2(in1,size1,in2,size2,out) drowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define c2c2catc2(in1,size1,in2,size2,out) crowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define z2z2catz2(in1,size1,in2,size2,out) zrowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define u82u82catu82(in1,size1,in2,size2,out) u8rowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define u162u162catu162(in1,size1,in2,size2,out) u16rowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define i82i82cati82(in1,size1,in2,size2,out) i8rowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+#define i162i162cati162(in1,size1,in2,size2,out) i16rowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out)
+
+/* Differents input elements */
+#define s0c0catc2(in1,in2,out) c0c0OpCcc2(FloatComplex(in1,0),in2,out)
+
+#define d0z0catz2(in1,in2,out) z0z0OpCcz2(DoubleComplex(in1,0),in2,out)
+
+#define c0s0catc2(in1,in2,out) c0c0OpCcc2(in1,FloatComplex(in2,0),out)
+
+#define z0d0catz2(in1,in2,out) z0z0OpCcz2(in1,DoubleComplex(in2,0),out)
+
+#define s2c2catc2(in1,size1,in2,size2,out) sfilla((float*)out,size1[0],size1[1],0); \
+ c2c2OpCcc2(FloatComplexMatrix(in1,(float*)out,size1[0]*size1[1]), size1, in2, size2, out)
+
+#define d2z2catz2(in1,size1,in2,size2,out) dfilla((double*)out,size1[0],size1[1],0); \
+ z2z2OpCcz2(DoubleComplexMatrix(in1,(double*)out,size1[0]*size1[1]), size1, in2, size2, out)
+
+#define c2s2catc2(in1,size1,in2,size2,out) sfilla((float*)out,size2[0],size2[1],0); \
+ c2c2OpCcc2(in1, size1, FloatComplexMatrix(in2,(float*)out,size2[0]*size2[1]), size2, out)
+
+#define z2d2catz2(in1,size1,in2,size2,out) dfilla((double*)out,size2[0],size2[1],0); \
+ z2z2OpCcz2(in1, size1, DoubleComplexMatrix(in2,(double*)out,size2[0]*size2[1]), size2, out)
+
+/* Matrix-Scalar */
+
+/* Same type */
+
+#define s2s0cats2(in1,size,in2,out) { float temp=in2; \
+ srowcata(in1, size[0], size[1],&temp, 1, 1, out); \
+ }
+
+#define d2d0catd2(in1,size,in2,out) { double temp=in2; \
+ drowcata(in1, size[0], size[1],&temp, 1, 1, out); \
+ }
+
+#define c2c0catc2(in1,size,in2,out) { floatComplex temp = in2; \
+ crowcata(in1, size[0], size[1],&temp, 1, 1, out);\
+ }
+
+#define z2z0catz2(in1,size,in2,out) { doubleComplex temp =in2; \
+ zrowcata(in1, size[0], size[1],&temp, 1, 1, out);\
+ }
+
+#define u82u80catu82(in1,size,in2,out) { uint8 temp=in2; \
+ u8rowcata(in1, size[0], size[1],&temp, 1,1,out);\
+ }
+#define u162u160catu162(in1,size,in2,out) { uint16 temp=in2; \
+ u16rowcata(in1, size[0], size[1],&temp, 1,1,out);\
+ }
+
+#define i82i80cati82(in1,size,in2,out) { int8 temp=in2; \
+ i8rowcata(in1, size[0], size[1],&temp, 1,1,out);\
+ }
+#define i162i160cati162(in1,size,in2,out) { int16 temp=in2; \
+ i16rowcata(in1, size[0], size[1],&temp, 1,1,out);\
+ }
+
+
+
+/* Different type */
+#define s2c0catc2(in1,size,in2,out) sfilla((float *)out,size[0],size[1],0); \
+ c2c0OpCcc2(FloatComplexMatrix(in1,(float*)out,size[0]*size[1]),size,in2,out)
+
+#define d2z0catz2(in1,size,in2,out) dfilla((double *)out,size[0],size[1],0); \
+ z2z0OpCcz2(DoubleComplexMatrix(in1,(double *)out,size[0]*size[1]),size,in2,out)
+
+#define c2s0catc2(in1,size,in2,out) { floatComplex temp = FloatComplex(in2, 0); c2c0OpCcc2(in1, size, temp, out)}
+
+#define z2d0catz2(in1,size,in2,out) { doubleComplex temp = DoubleComplex(in2, 0); z2z0OpCcz2(in1, size, temp, out)}
+
+
+/* Scalar-Matrix */
+
+/* Same type */
+#define s0s2cats2(in1,in2,size,out) { \
+ float __tmp1 = in1 ;\
+ srowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define d0d2catd2(in1,in2,size,out) { \
+ double __tmp1 = in1 ;\
+ drowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define c0c2catc2(in1,in2,size,out) { \
+ floatComplex __tmp1 = in1 ;\
+ crowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define z0z2catz2(in1,in2,size,out) { \
+ doubleComplex __tmp1 = in1 ;\
+ zrowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define u80u82catu82(in1,in2,size,out) { \
+ uint8 __tmp1 = in1;\
+ u8rowcata(&__tmp1, 1,1, in2, size[0], size[1], out);\
+}
+
+#define u160u162catu162(in1,in2,size,out) { \
+ uint16 __tmp1 = in1;\
+ u16rowcata(&__tmp1, 1,1, in2, size[0], size[1], out);\
+}
+
+#define i80i82cati82(in1,in2,size,out) { \
+ int8 __tmp1 = in1;\
+ i8rowcata(&__tmp1, 1,1, in2, size[0], size[1], out);\
+}
+
+#define i160i162cati162(in1,in2,size,out) { \
+ int16 __tmp1 = in1;\
+ i16rowcata(&__tmp1, 1,1, in2, size[0], size[1], out);\
+}
+
+
+/* Different type */
+#define s0c2catc2(in1,in2,size,out) c0c2OpCcc2(FloatComplex(in1,0),in2,size,out)
+
+#define d0z2catz2(in1,in2,size,out) z0z2OpCcz2(DoubleComplex(in1,0),in2,size,out)
+
+#define c0s2catc2(in1,in2,size,out) sfilla((float*)out,size[0],size[1],0); \
+ c0c2OpCcc2(in1,FloatComplexMatrix(in2,(float*)out,size[0]*size[1]),size,out)
+
+#define z0d2catz2(in1,in2,size,out) dfilla((double*)out,size[0],size[1],0); \
+ z0z2OpCcz2(in1,DoubleComplexMatrix(in2,(double*)out,size[0]*size[1]),size,out)
+
+
+#endif /* !__INT_CAT__H */
+
diff --git a/src/c/matrixOperations/interfaces/int_cross.h b/src/c/matrixOperations/interfaces/int_cross.h
new file mode 100644
index 00000000..8f4e7824
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_cross.h
@@ -0,0 +1,35 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_CROSS_H__
+#define __INT_CROSS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d2d2crossd2(in1,size1,in2,size2,out) dcrossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out)
+#define z2z2crossz2(in1,size1,in2,size2,out) zcrossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out)
+#define c2c2crossc2(in1,size1,in2,size2,out) ccrossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out)
+#define s2s2crosss2(in1,size1,in2,size2,out) scrossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out)
+#define u82u82crossu82(in1,size1,in2,size2,out) u8crossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out)
+#define i82i82crossi82(in1,size1,in2,size2,out) i8crossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out)
+#define u162u162crossu162(in1,size1,in2,size2,out) u16crossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out)
+#define i162i162crossi162(in1,size1,in2,size2,out) i16crossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_CROSS_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_cumprod.h b/src/c/matrixOperations/interfaces/int_cumprod.h
new file mode 100644
index 00000000..5ba3cc7a
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_cumprod.h
@@ -0,0 +1,54 @@
+/* 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
+*/
+
+#ifndef __INT_CUMPROD_H__
+#define __INT_CUMPROD_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0cumprodd0(in) in
+#define s0cumprods0(in) in
+#define u80cumprodu80(in) in
+#define u160cumprodu160(in) in
+#define i80cumprodi80(in) in
+#define i160cumprodi160(in) in
+
+#define d2cumprodd2(in1, size1, out) dcumproda(in1, size1[0], size1[1], out)
+#define s2cumprods2(in1, size1, out) scumproda(in1, size1[0], size1[1], out)
+#define u82cumprodu82(in1, size1, out) u8cumproda(in1, size1[0], size1[1], out)
+#define u162cumprodu162(in1, size1, out) u16cumproda(in1, size1[0], size1[1], out)
+#define i82cumprodi82(in1, size1, out) i8cumproda(in1, size1[0], size1[1], out)
+#define i162cumprodi162(in1, size1, out) i16cumproda(in1, size1[0], size1[1], out)
+
+#define d2g2cumprodd2(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ drowcumproda(in1,size1[0],size1[1],out) : dcolumncumproda(in1,size1[0],size1[1],out)
+#define s2g2cumprods2(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ srowcumproda(in1,size1[0],size1[1],out) : scolumncumproda(in1,size1[0],size1[1],out)
+#define u82g2cumprodu82(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ u8rowcumproda(in1,size1[0],size1[1],out) : u8columncumproda(in1,size1[0],size1[1],out)
+#define i82g2cumprodi82(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ i8rowcumproda(in1,size1[0],size1[1],out) : i8columncumproda(in1,size1[0],size1[1],out)
+#define u162g2cumprodu162(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ u16rowcumproda(in1,size1[0],size1[1],out) : u16columncumproda(in1,size1[0],size1[1],out)
+#define i162g2cumprodi162(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ i16rowcumproda(in1,size1[0],size1[1],out) : i16columncumproda(in1,size1[0],size1[1],out)
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_CUMPROD_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_cumsum.h b/src/c/matrixOperations/interfaces/int_cumsum.h
new file mode 100644
index 00000000..0eda0ac9
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_cumsum.h
@@ -0,0 +1,54 @@
+/* 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
+*/
+
+#ifndef __INT_CUMSUM_H__
+#define __INT_CUMSUM_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0cumsumd0(in) in
+#define s0cumsums0(in) in
+#define u80cumsumu80(in) in
+#define u160cumsumu160(in) in
+#define i80cumsumi80(in) in
+#define i160cumsumi160(in) in
+
+#define d2cumsumd2(in1, size1, out) dcumsuma(in1, size1[0], size1[1], out)
+#define s2cumsums2(in1, size1, out) scumsuma(in1, size1[0], size1[1], out)
+#define u82cumsumu82(in1, size1, out) u8cumsuma(in1, size1[0], size1[1], out)
+#define u162cumsumu162(in1, size1, out) u16cumsuma(in1, size1[0], size1[1], out)
+#define i82cumsumi82(in1, size1, out) i8cumsuma(in1, size1[0], size1[1], out)
+#define i162cumsumi162(in1, size1, out) i16cumsuma(in1, size1[0], size1[1], out)
+
+#define d2g2cumsumd2(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ drowcumsuma(in1,size1[0],size1[1],out) : dcolumncumsuma(in1,size1[0],size1[1],out)
+#define s2g2cumsums2(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ srowcumsuma(in1,size1[0],size1[1],out) : scolumncumsuma(in1,size1[0],size1[1],out)
+#define u82g2cumsumu82(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ u8rowcumsuma(in1,size1[0],size1[1],out) : u8columncumsuma(in1,size1[0],size1[1],out)
+#define i82g2cumsumi82(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ i8rowcumsuma(in1,size1[0],size1[1],out) : i8columncumsuma(in1,size1[0],size1[1],out)
+#define u162g2cumsumu162(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ u16rowcumsuma(in1,size1[0],size1[1],out) : u16columncumsuma(in1,size1[0],size1[1],out)
+#define i162g2cumsumi162(in1, size1, in2, size2, out) (in2[0]=='r') ? \
+ i16rowcumsuma(in1,size1[0],size1[1],out) : i16columncumsuma(in1,size1[0],size1[1],out)
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_CUMSUM_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_diag.h b/src/c/matrixOperations/interfaces/int_diag.h
new file mode 100644
index 00000000..339831b1
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_diag.h
@@ -0,0 +1,85 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#ifndef __INT_DIAG_H__
+#define __INT_DIAG_H__
+
+
+
+#define d0diagd0(in1) ddiags(in1)
+
+#define d0d0diagd0(in1,in2) ddiags(in1)
+
+#define d0d0diagd2(in1,in2,out) ddiaga(in1,1,in2,out)
+
+#define d2diagd2(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? ddiagins(in1,size[1],out) : ddiagins(in1,size[0],out); } else {ddiagexa(in1,size[0],size[1],0,out) ;}
+
+#define d2d0diagd2(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { ddiagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {ddiagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? ddiagins(in1,size[1],out) : ddiagins(in1,size[0],out); };}
+
+#define d2d0diagd0(in1,size,in2) ddiagexs(in1,size[0],size[1],in2)
+
+
+
+#define u80diagu80(in1) u8diags(in1)
+
+#define u80d0diagu80(in1,in2) u8diags(in1)
+
+#define u80d0diagu82(in1,in2,out) u8diaga(in1,1,in2,out)
+
+#define u82diagu82(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? u8diagins(in1,size[1],out) : u8diagins(in1,size[0],out); } else {u8diagexa(in1,size[0],size[1],0,out) ;}
+
+#define u82d0diagu82(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { u8diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {u8diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? u8diagins(in1,size[1],out) : u8diagins(in1,size[0],out); };}
+
+#define u82d0diagu80(in1,size,in2) u8diagexs(in1,size[0],size[1],in2)
+
+#define u160diagu160(in1) u16diags(in1)
+
+#define u160d0diagu160(in1,in2) u16diags(in1)
+
+#define u160d0diagu162(in1,in2,out) u16diaga(in1,1,in2,out)
+
+#define u162diagu162(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? u16diagins(in1,size[1],out) : u16diagins(in1,size[0],out); } else {u16diagexa(in1,size[0],size[1],0,out) ;}
+
+#define u162d0diagu162(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { u16diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {u16diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? u16diagins(in1,size[1],out) : u16diagins(in1,size[0],out); };}
+
+#define u162d0diagu160(in1,size,in2) u16diagexs(in1,size[0],size[1],in2)
+
+
+
+#define i80diagi80(in1) i8diags(in1)
+
+#define i80d0diagi80(in1,in2) i8diags(in1)
+
+#define i80d0diagi82(in1,in2,out) i8diaga(in1,1,in2,out)
+
+#define i82diagi82(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? i8diagins(in1,size[1],out) : i8diagins(in1,size[0],out); } else {i8diagexa(in1,size[0],size[1],0,out) ;}
+
+#define i82d0diagi82(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { i8diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {i8diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? i8diagins(in1,size[1],out) : i8diagins(in1,size[0],out); };}
+
+#define i82d0diagi80(in1,size,in2) i8diagexs(in1,size[0],size[1],in2)
+
+#define i160diagi160(in1) i16diags(in1)
+
+#define i160d0diagi160(in1,in2) i16diags(in1)
+
+#define i160d0diagi162(in1,in2,out) i16diaga(in1,1,in2,out)
+
+
+#define i162diagi162(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? i16diagins(in1,size[1],out) : i16diagins(in1,size[0],out); } else {i16diagexa(in1,size[0],size[1],0,out) ;}
+
+#define i162d0diagi162(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { i16diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {i16diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? i16diagins(in1,size[1],out) : i16diagins(in1,size[0],out); };}
+
+#define i162d0diagi160(in1,size,in2) i16diagexs(in1,size[0],size[1],in2)
+
+
+
+#endif /* !__INT_DIAG_H__ */
diff --git a/src/c/matrixOperations/interfaces/int_eye.h b/src/c/matrixOperations/interfaces/int_eye.h
index 81ed7fdd..1e10eb83 100644
--- a/src/c/matrixOperations/interfaces/int_eye.h
+++ b/src/c/matrixOperations/interfaces/int_eye.h
@@ -20,7 +20,13 @@
#define eyed0() 1
+#define eyeu80() (uint8)1
+#define eyei80() (int8)1
+
+#define eyeu160() (uint16)1
+
+#define eyei160() (int16)1
#define s0eyes0(in) seyes(in)
@@ -30,16 +36,37 @@
#define z0eyez0(in) zeyes(in)
+#define u80eyeu80(in) u8eyes(in)
+
+#define i80eyei80(in) i8eyes(in)
+
+#define u160eyeu160(in) u16eyes(in)
+
+#define i160eyei160(in) i16eyes(in)
#define s0s0eyes0(in1,in2) 1.0f
#define d0d0eyed0(in,in2) 1
+#define u80u80eyeu80(in1,in2) (uint8)1
+
+#define i80i80eyei80(in1,in2) (int8)1
+
+#define u160u160eyeu160(in1,in2) (uint16)1
+
+#define i160i160eyei160(in1,in2) (int16)1
#define s0s0eyes2(in1,in2,out) seyea(out, in1, in2)
#define d0d0eyed2(in1,in2,out) deyea(out, in1, in2)
+#define u80u80eyeu82(in1,in2,out) u8eyea(out, in1, in2)
+
+#define i80i80eyei82(in1,in2,out) i8eyea(out, in1, in2)
+
+#define u160u160eyeu162(in1,in2,out) u16eyea(out, in1, in2)
+
+#define i160i160eyei162(in1,in2,out) i16eyea(out, in1, in2)
#define s2eyes2(in,size,out) seyea(out, size[0], size[1])
@@ -49,5 +76,13 @@
#define z2eyez2(in,size,out) zeyea(out, size[0], size[1])
+#define u82eyeu82(in,size,out) u8eyea(out, size[0], size[1])
+
+#define i82eyei82(in,size,out) i8eyea(out, size[0], size[1])
+
+#define u162eyeu162(in,size,out) u16eyea(out, size[0], size[1])
+
+#define i162eyei162(in,size,out) i16eyea(out, size[0], size[1])
+
#endif /* !__INT_EYE_H__ */
diff --git a/src/c/matrixOperations/interfaces/int_flipdim.h b/src/c/matrixOperations/interfaces/int_flipdim.h
new file mode 100644
index 00000000..0c27181f
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_flipdim.h
@@ -0,0 +1,109 @@
+/* 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
+*/
+
+#ifndef __INT_FLIPDIM_H__
+#define __INT_FLIPDIM_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0d0flipdimd0(in1, in2) in1
+#define s0s0flipdims0(in1, in2) in1
+#define u80u80flipdimu80(in1, in2) in1
+#define i80i80flipdimi80(in1, in2) in1
+#define u160u160flipdimu160(in1, in2) in1
+#define i160i160flipdimi160(in1, in2) in1
+#define u80d0flipdimu80(in1, in2) in1
+#define i80d0flipdimi80(in1, in2) in1
+#define u160d0flipdimu160(in1, in2) in1
+#define i160d0flipdimi160(in1, in2) in1
+
+#define d0d0d0flipdimd0(in1, in2, in3) in1
+#define s0s0s0flipdims0(in1, in2, in3) in1
+#define u80u80u80flipdimu80(in1, in2, in3) in1
+#define i80i80i80flipdimi80(in1, in2, in3) in1
+#define u160u160u160flipdimu160(in1, in2, in3) in1
+#define i160i160i160flipdimi160(in1, in2, in3) in1
+#define u80d0d0flipdimu80(in1, in2, in3) in1
+#define i80d0d0flipdimi80(in1, in2, in3) in1
+#define u160d0d0flipdimu160(in1, in2, in3) in1
+#define i160d0d0flipdimi160(in1, in2, in3) in1
+
+
+#define d2d0flipdimd2(in1, size1, in2, out) dflipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define s2s0flipdims2(in1, size1, in2, out) sflipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define u82u80flipdimu82(in1, size1, in2, out) u8flipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define i82i80flipdimi82(in1, size1, in2, out) i8flipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define u162u160flipdimu162(in1, size1, in2, out) u16flipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define i162i160flipdimi162(in1, size1, in2, out) i16flipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define u82d0flipdimu82(in1, size1, in2, out) u8flipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define i82d0flipdimi82(in1, size1, in2, out) i8flipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define u162d0flipdimu162(in1, size1, in2, out) u16flipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define i162d0flipdimi162(in1, size1, in2, out) i16flipdima (in1, size1[0], size1[1], \
+ in2, 1, out);
+
+#define d2d0d0flipdimd2(in1, size1, in2, in3, out) dflipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define s2s0s0flipdims2(in1, size1, in2, in3, out) sflipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define u82u80u80flipdimu82(in1, size1, in2, in3, out) u8flipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define i82i80i80flipdimi82(in1, size1, in2, in3, out) i8flipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define u162u160u160flipdimu162(in1, size1, in2, in3, out) u16flipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define i162i160i160flipdimi162(in1, size1, in2, in3, out) i16flipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define u82d0d0flipdimu82(in1, size1, in2, in3, out) u8flipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define i82d0d0flipdimi82(in1, size1, in2, in3, out) i8flipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define u162d0d0flipdimu162(in1, size1, in2, in3, out) u16flipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+#define i162d0d0flipdimi162(in1, size1, in2, in3, out) i16flipdima(in1, size1[0], size1[1], \
+ in2, in3, out);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_FLIPDIM_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_invert.h b/src/c/matrixOperations/interfaces/int_invert.h
index d31481b6..285a0f4a 100644
--- a/src/c/matrixOperations/interfaces/int_invert.h
+++ b/src/c/matrixOperations/interfaces/int_invert.h
@@ -23,6 +23,14 @@
#define z0invz0(in) zrdivs(DoubleComplex(1,0),in)
+#define u80invs0(in) 1.0f/(float)in
+
+#define i80invs0(in) 1.0f/(float)in
+
+#define u160invs0(in) 1.0f/(float)in
+
+#define i160invs0(in) 1.0f/(float)in
+
#define s2invs2(in,size,out) sinverma(in, out, size[0])
#define d2invd2(in,size,out) dinverma(in, out, size[0])
@@ -31,4 +39,12 @@
#define z2invz2(in,size,out) zinverma(in, out, size[0])
+#define u82invs2(in,size,out) u8inverma(in, out, size[0])
+
+#define i82invs2(in,size,out) i8inverma(in, out, size[0])
+
+#define u162invs2(in,size,out) u16inverma(in, out, size[0])
+
+#define i162invs2(in,size,out) i16inverma(in, out, size[0])
+
#endif /* !__INT_INV_H__ */
diff --git a/src/c/matrixOperations/interfaces/int_kron.h b/src/c/matrixOperations/interfaces/int_kron.h
new file mode 100644
index 00000000..a6fbaab1
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_kron.h
@@ -0,0 +1,43 @@
+/* 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
+*/
+
+#ifndef __INT_KRON_H__
+#define __INT_KRON_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0d0krond0(in1, in2) in1*in2
+#define s0s0krons0(in1, in2) in1*in2
+
+#define d0d2krond2(in1, in2, size2, out) {int i; \
+ for(i=0;i < size2[0]*size2[1];i++) out[i] = in2[i]*in1;}
+#define s0s2krons2(in1, in2, size2, out) {int i; \
+ for(i=0;i < size2[0]*size2[1];i++) out[i] = in2[i]*in1;}
+
+#define d2d0krond2(in1, size1, in2, out) {int i; \
+ for(i=0;i < size1[0]*size1[1];i++) out[i] = in1[i]*in2;}
+#define s2s0krons2(in1, in2, size2, out) {int i; \
+ for(i=0;i < size2[0]*size2[1];i++) out[i] = in2[i]*in1;}
+
+#define d2d2krond2(in1, size1, in2, size2, out) dkrona(in1, size1[0], size1[1], \
+ in2, size2[0], size2[1], out);
+#define s2s2krons2(in1, size1, in2, size2, out) skrona(in1, size1[0], size1[1], \
+ in2, size2[0], size2[1], out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_KRON_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_matrix.h b/src/c/matrixOperations/interfaces/int_matrix.h
new file mode 100644
index 00000000..5935f4a3
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_matrix.h
@@ -0,0 +1,49 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#ifndef __INT_MATRIX_H__
+#define __INT_MATRIX_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d2d0d0matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out)
+#define d2s0s0matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out)
+//#define d2u160u160matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out)
+//#define d2u80u80matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out)
+
+#define s2d0d0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+#define s2s0s0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+
+#define u162d0d0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out)
+#define u162s0s0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+
+#define z2d0d0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out)
+#define z2s0s0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+
+
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_MATRIX_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_ndgrid.h b/src/c/matrixOperations/interfaces/int_ndgrid.h
new file mode 100644
index 00000000..b7fd0a65
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_ndgrid.h
@@ -0,0 +1,28 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_NDGRID_H__
+#define __INT_NDGRID_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d2d2ndgridd2d2(in1,size1,in2,size2,out1,out2) dndgrida(in1,size1[0]*size1[1],in2,size2[0]*size2[1],out1,out2)
+#define s2s2ndgrids2s2(in1,size1,in2,size2,out1,out2) sndgrida(in1,size1[0]*size1[1],in2,size2[0]*size2[1],out1,out2)
+#define z2z2ndgridz2z2(in1,size1,in2,size2,out1,out2) zndgrida(in1,size1[0]*size1[1],in2,size2[0]*size2[1],out1,out2)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_NDGRID_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_nnz.h b/src/c/matrixOperations/interfaces/int_nnz.h
new file mode 100644
index 00000000..0ef39536
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_nnz.h
@@ -0,0 +1,35 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#ifndef __INT_NNZ_H__
+#define __INT_NNZ_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d2nnzu160(in1, size) dnnza(in1, size[0], size[1])
+#define d0nnzu160(in) dnnzs(in)
+
+#define s2nnzu160(in1, size) snnza(in1, size[0], size[1])
+#define s0nnzu160(in) snnzs(in)
+
+#define z2nnzu160(in1, size) znnza(in1, size[0], size[1])
+#define z0nnzu160(in) znnzs(in)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_NNZ_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_norm.h b/src/c/matrixOperations/interfaces/int_norm.h
new file mode 100644
index 00000000..a42a6754
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_norm.h
@@ -0,0 +1,53 @@
+ /* 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
+ */
+
+#ifndef __INT_NORM_H__
+#define __INT_NORM_H__
+
+#include "statMax.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0normd0(in) in
+#define s0norms0(in) in
+
+#define d2normd0(in,size,out) ((size[0] == 1) || (size[1]==1))? \
+ dnormv(in, size[0]*size[1], 2): \
+ dnorma(in, size[0], size[1], 2)
+
+#define s2norms0(in,size,out) ((size[0] == 1) || (size[1]==1))? \
+ snormv(in, size[0]*size[1], 2): \
+ snorma(in, size[0], size[1], 2)
+
+#define d2d0normd0(in,size,norm) ((size[0] == 1) || (size[1]==1))? \
+ dnormv(in,size[0]*size[1],norm) : \
+ dnorma(in,size[0],size[1],norm)
+
+#define s2s0norms0(in,size,norm) ((size[0] == 1) || (size[1]==1))? \
+ snormv(in,size[0]*size[1],norm) : \
+ snorma(in,size[0],size[1],norm)
+
+#define d2g2normd0(in,size,norm,normsize) ((size[0] == 1) || (size[1]==1))? \
+ (norm[0]=='i') ? dmaxa(in,size[0]*size[1]) : dnormv(in,size[0]*size[1],2) : \
+ (norm[0]=='i') ? dnorma(in,size[0],size[1],3) : dnorma(in,size[0],size[1],4)
+
+#define s2g2norms0(in,size,norm,normsize) ((size[0] == 1) || (size[1]==1))? \
+ (norm[0]=='i') ? smaxa(in,size[0]*size[1]) : snormv(in,size[0]*size[1],2) : \
+ (norm[0]=='i') ? snorma(in,size[0],size[1],3) : snorma(in,size[0],size[1],4)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_NORM_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_ones.h b/src/c/matrixOperations/interfaces/int_ones.h
index 0259b4c6..e266ee52 100644
--- a/src/c/matrixOperations/interfaces/int_ones.h
+++ b/src/c/matrixOperations/interfaces/int_ones.h
@@ -20,7 +20,13 @@
#define onesd0() 1
+#define onesu80() (uint8)1
+#define onesi80() (int8)1
+
+#define onesu160() (uint16)1
+
+#define onesi160() (int16)1
#define s0oness0(in) soness(in)
@@ -30,16 +36,37 @@
#define z0onesz0(in) zoness(in)
+#define u80onesu80(in) u8oness(in)
+
+#define i80onesi80(in) i8oness(in)
+
+#define u160onesu160(in) u16oness(in)
+
+#define i160onesi160(in) i16oness(in)
#define s0s0oness0(in1,in2) 1.0f
#define d0d0onesd0(in,in2) 1
+#define u80u80onesu80(in1,in2) (uint8)1
+
+#define i80i80onesi80(in1,in2) (int8)1
+
+#define u160u160onesu160(in1,in2) (uint16)1
+
+#define i160i160onesi160(in1,in2) (int16)1
#define s0s0oness2(in1,in2,out) sonesa(out, in1, in2)
#define d0d0onesd2(in1,in2,out) donesa(out, in1, in2)
+#define u80u80onesu82(in1,in2,out) u8onesa(out, in1, in2)
+
+#define i80i80onesi82(in1,in2,out) i8onesa(out, in1, in2)
+
+#define u160u160onesu162(in1,in2,out) u16onesa(out, in1, in2)
+
+#define i160i160onesi162(in1,in2,out) i16onesa(out, in1, in2)
#define s2oness2(in,size,out) sonesa(out, size[0], size[1])
@@ -49,5 +76,12 @@
#define z2onesz2(in,size,out) zonesa(out, size[0], size[1])
+#define u82onesu82(in,size,out) u8onesa(out, size[0], size[1])
+
+#define i82onesi82(in,size,out) i8onesa(out, size[0], size[1])
+
+#define u162onesu162(in,size,out) u16onesa(out, size[0], size[1])
+
+#define i162onesi162(in,size,out) i16onesa(out, size[0], size[1])
#endif /* !__INT_ONES_H__ */
diff --git a/src/c/matrixOperations/interfaces/int_permute.h b/src/c/matrixOperations/interfaces/int_permute.h
new file mode 100644
index 00000000..66049aca
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_permute.h
@@ -0,0 +1,28 @@
+/* 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
+*/
+
+#ifndef __INT_PERMUTE_H__
+#define __INT_PERMUTE_H__
+
+
+#ifdef __cplusplus
+#extern "C" {
+#endif
+
+#define d2d2permuted2(in1, size1, in2, size2, out) (if(in2[0]==1)?in1: \
+ dtransposea(in1, size1[0],size1[1],out))
+
+#ifdef __cplusplus
+#} /* extern "C" */
+#endif
+
+#endif /*__INT_FLIPDIM_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_pertrans.h b/src/c/matrixOperations/interfaces/int_pertrans.h
new file mode 100644
index 00000000..8aa8ec5e
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_pertrans.h
@@ -0,0 +1,34 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#ifndef __INT_PERTRANS_H__
+#define __INT_PERTRANS_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d2pertransd2(in1, size, out) dpertransa(in1, size[0], size[1], out)
+#define d0pertransd0(in1) dpertranss(in1)
+
+#define s2pertranss2(in1, size, out) spertransa(in1, size[0], size[1], out)
+#define s0pertranss0(in1) spertranss(in1)
+
+#define z2pertransz2(in1, size, out) zpertransa(in1, size[0], size[1], out)
+#define z0pertransz0(in1) zpertranss(in1)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_PERTRANS_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_toeplitz.h b/src/c/matrixOperations/interfaces/int_toeplitz.h
new file mode 100644
index 00000000..b602e9a8
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_toeplitz.h
@@ -0,0 +1,50 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_TOEPLITZ_H__
+#define __INT_TOEPLITZ_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d2d2toeplitzd2(in1,size1,in2,size2,out) dtoeplitza(in1,size1[1],in2,size2[1],out)
+#define d2toeplitzd2(in1,size1,out) dtoeplitza(in1,size1[1],in1,size1[1],out)
+
+#define u82u82toeplitzu82(in1,size1,in2,size2,out) u8toeplitza(in1,size1[1],in2,size2[1],out)
+#define u82toeplitzu82(in1,size1,out) u8toeplitza(in1,size1[1],in1,size1[1],out)
+
+#define u162u162toeplitzu162(in1,size1,in2,size2,out) u16toeplitza(in1,size1[1],in2,size2[1],out)
+#define u162toeplitzu162(in1,size1,out) u16toeplitza(in1,size1[1],in1,size1[1],out)
+
+#define g2g2toeplitzg2(in1,size1,in2,size2,out) gtoeplitza(in1,size1[1],in2,size2[1],out)
+#define g2toeplitzg2(in1,size1,out) gtoeplitza(in1,size1[1],in1,size1[1],out)
+
+#define z2z2toeplitzz2(in1,size1,in2,size2,out) ztoeplitza(in1,size1[1],in2,size2[1],out)
+#define z2toeplitzz2(in1,size1,out) ztoeplitza(in1,size1[1],in1,size1[1],out)
+
+#define s2s2toeplitzs2(in1,size1,in2,size2,out) stoeplitza(in1,size1[1],in2,size2[1],out)
+#define s2toeplitzs2(in1,size1,out) stoeplitza(in1,size1[1],in1,size1[1],out)
+
+#define c2c2toeplitzc2(in1,size1,in2,size2,out) ctoeplitza(in1,size1[1],in2,size2[1],out)
+#define c2toeplitzc2(in1,size1,out) ctoeplitza(in1,size1[1],in1,size1[1],out)
+
+#define i82i82toeplitzi82(in1,size1,in2,size2,out) i8toeplitza(in1,size1[1],in2,size2[1],out)
+#define i82toeplitzi82(in1,size1,out) i8toeplitza(in1,size1[1],in1,size1[1],out)
+
+#define i162i162toeplitzi162(in1,size1,in2,size2,out) i16toeplitza(in1,size1[1],in2,size2[1],out)
+#define i162toeplitzi162(in1,size1,out) i16toeplitza(in1,size1[1],in1,size1[1],out)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_TOEPLITZ_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_trace.h b/src/c/matrixOperations/interfaces/int_trace.h
index 8bfea860..58c42991 100644
--- a/src/c/matrixOperations/interfaces/int_trace.h
+++ b/src/c/matrixOperations/interfaces/int_trace.h
@@ -21,7 +21,13 @@
#define c0tracec0(in) in
-#define z0tracez0(in) in
+#define u80traceu80(in) (uint8)in
+
+#define u160traceu160(in) (uint16)in
+
+#define i80tracei80(in) (int8)in
+
+#define i160tracei160(in) (int16)in
#define s2traces0(in,size) stracea(in, size[0])
@@ -31,4 +37,12 @@
#define z2tracez0(in,size) ztracea(in, size[0])
+#define u82traceu80(in,size) u8tracea(in, size[0])
+
+#define u162traceu160(in,size) u16tracea(in, size[0])
+
+#define i82tracei80(in,size) i8tracea(in, size[0])
+
+#define i162tracei160(in,size) i16trace(in,size[0])
+
#endif /* !__INT_TRACE_H__ */
diff --git a/src/c/matrixOperations/interfaces/int_transpose.h b/src/c/matrixOperations/interfaces/int_transpose.h
index 250d565f..3fd328f6 100644
--- a/src/c/matrixOperations/interfaces/int_transpose.h
+++ b/src/c/matrixOperations/interfaces/int_transpose.h
@@ -23,6 +23,14 @@
#define z0transposez0(in) in
+#define u80transposeu80(in) (uint8)in
+
+#define u160transposeu160(in) (uint16)in
+
+#define i80transposei80(in) (int8)in
+
+#define i160transposei160(in) (int16)in
+
#define s2transposes2(in,size,out) stransposea(in, size[0], size[1], out)
#define d2transposed2(in,size,out) dtransposea(in, size[0], size[1], out)
@@ -31,4 +39,13 @@
#define z2transposez2(in,size,out) ztransposea(in, size[0], size[1], out)
+
+#define u82transposeu82(in,size,out) u8transposea(in, size[0], size[1], out)
+
+#define u162transposeu162(in,size,out) u16transposea(in, size[0], size[1], out)
+
+#define i82transposei82(in,size,out) i8transposea(in, size[0], size[1], out)
+
+#define i162transposei162(in,size,out) i16transposea(in, size[0], size[1], out)
+
#endif /* !__INT_TRANSPOSE_H__ */
diff --git a/src/c/matrixOperations/interfaces/int_tril.h b/src/c/matrixOperations/interfaces/int_tril.h
new file mode 100644
index 00000000..6d694519
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_tril.h
@@ -0,0 +1,62 @@
+/* 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
+*/
+
+#ifndef __INT_TRIL_H__
+#define __INT_TRIL_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0trild0(in) in
+#define s0trils0(in) in
+#define u80trilu80(in) in
+#define u160trilu160(in) in
+#define i80trili80(in) in
+#define i160trili160(in) in
+
+#define d0d0trild0(in1, in2) (in2 == 0 ? in1 : 0)
+#define s0s0trils0(in1, in2) (in2 == 0 ? in1 : 0)
+#define u80u80trilu80(in1, in2) (in2 == 0 ? in1 : 0)
+#define i80i80trili80(in1, in2) (in2 == 0 ? in1 : 0)
+#define u160u160trilu160(in1, in2) (in2 == 0 ? in1 : 0)
+#define i160i160trili160(in1, in2) (in2 == 0 ? in1 : 0)
+#define u80d0trilu80(in1, in2) (in2 == 0 ? in1 : 0)
+#define i80d0trili80(in1, in2) (in2 == 0 ? in1 : 0)
+#define u160d0trilu160(in1, in2) (in2 == 0 ? in1 : 0)
+#define i160d0trili160(in1, in2) (in2 == 0 ? in1 : 0)
+
+#define d2trild2(in, size, out) dtrila(in, size[0], size[1], 0, out);
+#define s2trils2(in, size, out) strila(in, size[0], size[1], 0, out);
+#define u82trilu82(in, size, out) u8trila(in, size[0], size[1], 0, out);
+#define u162trilu162(in, size, out) u16trila(in, size[0], size[1], 0, out);
+#define i82trili82(in, size, out) i8trila(in, size[0], size[1], 0, out);
+#define i162trili162(in, size, out) i16trila(in, size[0], size[1], 0, out);
+
+#define d2d0trild2(in1, size1, in2, out) dtrila(in1, size1[0], size1[1], in2, out);
+#define s2s0trils2(in1, size1, in2, out) strila(in1, size1[0], size1[1], in2, out);
+#define u82u80trilu82(in1, size1, in2, out) u8trila(in1, size1[0], size1[1], (double)in2, out);
+#define i82i80trili82(in1, size1, in2, out) i8trila(in1, size1[0], size1[1], (double)in2, out);
+#define u162u160trilu162(in1, size1, in2, out) u16trila(in1, size1[0], size1[1], (double)in2, out);
+#define i162i160trili162(in1, size1, in2, out) i16trila(in1, size1[0], size1[1], (double)in2, out);
+#define u82d0trilu82(in1, size1, in2, out) u8trila(in1, size1[0], size1[1], in2, out);
+#define i82d0trili82(in1, size1, in2, out) i8trila(in1, size1[0], size1[1], in2, out);
+#define u162d0trilu162(in1, size1, in2, out) u16trila(in1, size1[0], size1[1], in2, out);
+#define i162d0trili162(in1, size1, in2, out) i16trila(in1, size1[0], size1[1], in2, out);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_TRIL_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_triu.h b/src/c/matrixOperations/interfaces/int_triu.h
new file mode 100644
index 00000000..1aef3115
--- /dev/null
+++ b/src/c/matrixOperations/interfaces/int_triu.h
@@ -0,0 +1,62 @@
+/* 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
+*/
+
+#ifndef __INT_TRIU_H__
+#define __INT_TRIU_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0triud0(in) in
+#define s0trius0(in) in
+#define u80triuu80(in) in
+#define u160triuu160(in) in
+#define i80triui80(in) in
+#define i160triui160(in) in
+
+#define d0d0triud0(in1, in2) (in2 == 0 ? in1 : 0)
+#define s0s0trius0(in1, in2) (in2 == 0 ? in1 : 0)
+#define u80u80triuu80(in1, in2) (in2 == 0 ? in1 : 0)
+#define i80i80triui80(in1, in2) (in2 == 0 ? in1 : 0)
+#define u160u160triuu160(in1, in2) (in2 == 0 ? in1 : 0)
+#define i160i160triui160(in1, in2) (in2 == 0 ? in1 : 0)
+#define u80d0triuu80(in1, in2) (in2 == 0 ? in1 : 0)
+#define i80d0triui80(in1, in2) (in2 == 0 ? in1 : 0)
+#define u160d0triuu160(in1, in2) (in2 == 0 ? in1 : 0)
+#define i160d0triui160(in1, in2) (in2 == 0 ? in1 : 0)
+
+#define d2triud2(in, size, out) dtriua(in, size[0], size[1], 0, out);
+#define s2trius2(in, size, out) striua(in, size[0], size[1], 0, out);
+#define u82triuu82(in, size, out) u8triua(in, size[0], size[1], 0, out);
+#define u162triuu162(in, size, out) u16triua(in, size[0], size[1], 0, out);
+#define i82triui82(in, size, out) i8triua(in, size[0], size[1], 0, out);
+#define i162triui162(in, size, out) i16triua(in, size[0], size[1], 0, out);
+
+#define d2d0triud2(in1, size1, in2, out) dtriua(in1, size1[0], size1[1], in2, out);
+#define s2s0trius2(in1, size1, in2, out) striua(in1, size1[0], size1[1], in2, out);
+#define u82u80triuu82(in1, size1, in2, out) u8triua(in1, size1[0], size1[1], (double)in2, out);
+#define i82i80triui82(in1, size1, in2, out) i8triua(in1, size1[0], size1[1], (double)in2, out);
+#define u162u160triuu162(in1, size1, in2, out) u16triua(in1, size1[0], size1[1], (double)in2, out);
+#define i162i160triui162(in1, size1, in2, out) i16triua(in1, size1[0], size1[1], (double)in2, out);
+#define u82d0triuu82(in1, size1, in2, out) u8triua(in1, size1[0], size1[1], in2, out);
+#define i82d0triui82(in1, size1, in2, out) i8triua(in1, size1[0], size1[1], in2, out);
+#define u162d0triuu162(in1, size1, in2, out) u16triua(in1, size1[0], size1[1], in2, out);
+#define i162d0triui162(in1, size1, in2, out) i16triua(in1, size1[0], size1[1], in2, out);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_TRIU_H__*/
diff --git a/src/c/matrixOperations/interfaces/int_vmagn.h b/src/c/matrixOperations/interfaces/int_vmagn.h
index 8a51755e..a8647aa2 100644
--- a/src/c/matrixOperations/interfaces/int_vmagn.h
+++ b/src/c/matrixOperations/interfaces/int_vmagn.h
@@ -24,6 +24,14 @@
#define z0vmagnz0(in) zmagns(in)
+#define u80vmagnu80(in) u8magns(in)
+
+#define u160vmagnu160(in) u16magns(in)
+
+#define i80vmagni80(in) i8magns(in)
+
+#define i160vmagni160(in) i16magns(in)
+
#define s2vmagns2(in,size) smagna(in, size[0], size[1])
#define d2vmagnd2(in,size) dmagna(in, size[0], size[1])
@@ -32,4 +40,12 @@
#define z2vmagnz2(in,size) zmagna(in, size[0], size[1])
+#define u82vmagnu82(in,size) u8magna(in, size[0], size[1])
+
+#define u162vmagnu162(in,size) u16magna(in, size[0], size[1])
+
+#define i82vmagni82(in,size) i8magna(in, size[0], size[1])
+
+#define i162vmagni162(in,size) i16magna(in, size[0], size[1])
+
#endif /* !__INT_VMAGN_H__ */
diff --git a/src/c/matrixOperations/interfaces/int_zeros.h b/src/c/matrixOperations/interfaces/int_zeros.h
index 4bc32138..ac7e020e 100644
--- a/src/c/matrixOperations/interfaces/int_zeros.h
+++ b/src/c/matrixOperations/interfaces/int_zeros.h
@@ -21,7 +21,13 @@
#define zerosd0() 0
+#define zerosu80() (uint8)0
+#define zerosi80() (int8)0
+
+#define zerosu160() (uint16)0
+
+#define zerosi160() (int16)0
#define s0zeross0(in) szeross(in)
@@ -31,16 +37,37 @@
#define z0zerosz0(in) zzeross(in)
+#define u80zerosu80(in) u8zeross(in)
+
+#define i80zerosi80(in) i8zeross(in)
+
+#define u160zerosu160(in) u16zeross(in)
+
+#define i160zerosi160(in) i16zeross(in)
#define s0s0zeross0(in1,in2) 0.0f
-#define d0d0zerosd0(in,in2) 0
+#define d0d0zerosd0(in1,in2) 0
+
+#define u80u80zerosu80(in1,in2) (uint8)0
+
+#define i80i80zerosi80(in1,in2) (int8)0
+
+#define u160u160zerosu160(in1,in2) (uint16)0
+#define i160i160zerosi160(in1,in2) (int16)0
#define s0s0zeross2(in1,in2,out) szerosa(out, in1, in2)
#define d0d0zerosd2(in1,in2,out) dzerosa(out, in1, in2)
+#define u80u80zerosu82(in1,in2,out) u8zerosa(out, in1, in2)
+
+#define i80i80zerosi82(in1,in2,out) i8zerosa(out, in1, in2)
+
+#define u160u160zerosu162(in1,in2,out) u16zerosa(out, in1, in2)
+
+#define i160i160zerosi162(in1,in2,out) i16zerosa(out, in1, in2)
#define s2zeross2(in,size,out) szerosa(out, size[0], size[1])
@@ -50,5 +77,13 @@
#define z2zerosz2(in,size,out) zzerosa(out, size[0], size[1])
+#define u82zerosu82(in,size,out) u8zerosa(out, size[0], size[1])
+
+#define i82zerosi82(in,size,out) i8zerosa(out, size[0], size[1])
+
+#define u162zerosu162(in,size,out) u16zerosa(out, size[0], size[1])
+
+#define i162zerosi162(in,size,out) i16zerosa(out, size[0], size[1])
+
#define d0d0d0zerosd3(in1, in2, in3, out) dzerosh(out, in1, in2, in3);
#endif /* !__INT_ZEROS_H__ */
diff --git a/src/c/matrixOperations/interfaces/interface.sh b/src/c/matrixOperations/interfaces/interface.sh
index 8c7f073b..8c7f073b 100755..100644
--- a/src/c/matrixOperations/interfaces/interface.sh
+++ b/src/c/matrixOperations/interfaces/interface.sh
diff --git a/src/c/matrixOperations/inversion/i16inverma.c b/src/c/matrixOperations/inversion/i16inverma.c
new file mode 100644
index 00000000..0dd18509
--- /dev/null
+++ b/src/c/matrixOperations/inversion/i16inverma.c
@@ -0,0 +1,55 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include "matrixInversion.h"
+#include "lapack.h"
+
+void i16inverma ( int16* in, float* out, int leadDimIn )
+{
+
+ int i = 0 ;
+ /* these 3 variable are created to permit to use the value in the fortran functions
+ because they need double matrix as arguments and we can't cast directly the pointers
+ without having problems , i know that's ugly */
+ double *dblin = NULL;
+ double *dblout = NULL;
+
+
+
+ /* Array allocations*/
+ dblin = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn));
+ dblout = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn));
+
+
+
+ /*copy and cast all the float value into double value */
+ for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i ++ )
+ {
+ dblin[i] = (double) in[i] ;
+ }
+
+ dinverma ( dblin, dblout, leadDimIn );
+
+
+ for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i++ )
+ {
+ out[i] =(float) dblout[i] ;
+
+ }
+
+ free ( dblin);
+ free ( dblout);
+
+}
diff --git a/src/c/matrixOperations/inversion/i8inverma.c b/src/c/matrixOperations/inversion/i8inverma.c
new file mode 100644
index 00000000..66c66e2f
--- /dev/null
+++ b/src/c/matrixOperations/inversion/i8inverma.c
@@ -0,0 +1,55 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include "matrixInversion.h"
+#include "lapack.h"
+
+void i8inverma ( int8* in, float* out, int leadDimIn )
+{
+
+ int i = 0 ;
+ /* these 3 variable are created to permit to use the value in the fortran functions
+ because they need double matrix as arguments and we can't cast directly the pointers
+ without having problems , i know that's ugly */
+ double *dblin = NULL;
+ double *dblout = NULL;
+
+
+
+ /* Array allocations*/
+ dblin = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn));
+ dblout = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn));
+
+
+
+ /*copy and cast all the float value into double value */
+ for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i ++ )
+ {
+ dblin[i] = (double) in[i] ;
+ }
+
+ dinverma ( dblin, dblout, leadDimIn );
+
+
+ for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i++ )
+ {
+ out[i] =(float) dblout[i] ;
+
+ }
+
+ free ( dblin);
+ free ( dblout);
+
+}
diff --git a/src/c/matrixOperations/inversion/u16inverma.c b/src/c/matrixOperations/inversion/u16inverma.c
new file mode 100644
index 00000000..917c9af8
--- /dev/null
+++ b/src/c/matrixOperations/inversion/u16inverma.c
@@ -0,0 +1,55 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include "matrixInversion.h"
+#include "lapack.h"
+
+void u16inverma ( uint16* in, float* out, int leadDimIn )
+{
+
+ int i = 0 ;
+ /* these 3 variable are created to permit to use the value in the fortran functions
+ because they need double matrix as arguments and we can't cast directly the pointers
+ without having problems , i know that's ugly */
+ double *dblin = NULL;
+ double *dblout = NULL;
+
+
+
+ /* Array allocations*/
+ dblin = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn));
+ dblout = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn));
+
+
+
+ /*copy and cast all the float value into double value */
+ for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i ++ )
+ {
+ dblin[i] = (double) in[i] ;
+ }
+
+ dinverma ( dblin, dblout, leadDimIn );
+
+
+ for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i++ )
+ {
+ out[i] =(float) dblout[i] ;
+
+ }
+
+ free ( dblin);
+ free ( dblout);
+
+}
diff --git a/src/c/matrixOperations/inversion/u8inverma.c b/src/c/matrixOperations/inversion/u8inverma.c
new file mode 100644
index 00000000..2fab6597
--- /dev/null
+++ b/src/c/matrixOperations/inversion/u8inverma.c
@@ -0,0 +1,55 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include "matrixInversion.h"
+#include "lapack.h"
+
+void u8inverma ( uint8* in, float* out, int leadDimIn )
+{
+
+ int i = 0 ;
+ /* these 3 variable are created to permit to use the value in the fortran functions
+ because they need double matrix as arguments and we can't cast directly the pointers
+ without having problems , i know that's ugly */
+ double *dblin = NULL;
+ double *dblout = NULL;
+
+
+
+ /* Array allocations*/
+ dblin = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn));
+ dblout = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn));
+
+
+
+ /*copy and cast all the float value into double value */
+ for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i ++ )
+ {
+ dblin[i] = (double) in[i] ;
+ }
+
+ dinverma ( dblin, dblout, leadDimIn );
+
+
+ for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i++ )
+ {
+ out[i] =(float) dblout[i] ;
+
+ }
+
+ free ( dblin);
+ free ( dblout);
+
+}
diff --git a/src/c/matrixOperations/kron/dkrona.c b/src/c/matrixOperations/kron/dkrona.c
new file mode 100644
index 00000000..31e0a52e
--- /dev/null
+++ b/src/c/matrixOperations/kron/dkrona.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function for kroneker product of two matrices*/
+
+#include "kron.h"
+
+void dkrona (double *in1, int row1, int col1, double *in2, int row2, \
+ int col2, double *out)
+{
+ int row1_count, col1_count,row2_count, col2_count;
+ int row = row1*row2;
+ int temp = 0;
+
+ for(col1_count = 0;col1_count < col1; col1_count++)
+ {
+ for(row1_count = 0;row1_count < row1; row1_count++)
+ {
+ for(col2_count = 0;col2_count < col2; col2_count++)
+ {
+ for(row2_count = 0;row2_count < row2; row2_count++)
+ {
+ temp = (col1_count*col2+col2_count)*row+(row1_count*row2+row2_count);
+ out[temp] = in1[col1_count*row1+row1_count]*in2[col2_count*row2+row2_count];
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/kron/skrona.c b/src/c/matrixOperations/kron/skrona.c
new file mode 100644
index 00000000..1e0daaf1
--- /dev/null
+++ b/src/c/matrixOperations/kron/skrona.c
@@ -0,0 +1,39 @@
+/* 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
+*/
+
+/*Function for kroneker product of two matrices*/
+
+#include "kron.h"
+
+void skrona (float *in1, int row1, int col1, float *in2, int row2, \
+ int col2, float *out)
+{
+ int row1_count, col1_count,row2_count, col2_count;
+ int row = row1*row2;
+ int temp = 0;
+
+ for(col1_count = 0;col1_count < col1; col1_count++)
+ {
+ for(row1_count = 0;row1_count < row1; row1_count++)
+ {
+ for(col2_count = 0;col2_count < col2; col2_count++)
+ {
+ for(row2_count = 0;row2_count < row2; row2_count++)
+ {
+ temp = (col1_count*col2+col2_count)*row+(row1_count*row2+row2_count);
+ out[temp] = in1[col1_count*row1+row1_count]*in2[col2_count*row2+row2_count];
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/magnitude/i16magna.c b/src/c/matrixOperations/magnitude/i16magna.c
new file mode 100644
index 00000000..193d2377
--- /dev/null
+++ b/src/c/matrixOperations/magnitude/i16magna.c
@@ -0,0 +1,43 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+
+#include "matrixMagnitude.h"
+
+int16 i16magna(int16* in, int rows, int cols){
+ int i=0,j=0;
+ int16 out=0, colSum=0;
+
+ /* Other method :
+ drowsuma(in,rows,cols,temp);
+ out=max(temp,cols);
+ but we have to malloc a array */
+
+ if ((rows==1)||(cols==1)){
+ for(i=0;i<cols*rows;i++){
+ out += dmagns(in[i]);
+ }
+ }
+ else{
+ for(i=0;i<cols;i++){
+ colSum = 0;
+ for(j=0;j<rows;j++){
+ colSum += dmagns(in[i*rows+j]);
+ }
+ if (colSum>out) out=colSum;
+ }
+ }
+ return out;
+}
+
+
diff --git a/src/c/matrixOperations/magnitude/i16magns.c b/src/c/matrixOperations/magnitude/i16magns.c
new file mode 100644
index 00000000..44800ca6
--- /dev/null
+++ b/src/c/matrixOperations/magnitude/i16magns.c
@@ -0,0 +1,22 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+
+#include "matrixMagnitude.h"
+#include "abs.h"
+
+int16 i16magns(int16 in){
+ return i16abss(in);
+}
+
+
diff --git a/src/c/matrixOperations/magnitude/i8magna.c b/src/c/matrixOperations/magnitude/i8magna.c
new file mode 100644
index 00000000..8de96b74
--- /dev/null
+++ b/src/c/matrixOperations/magnitude/i8magna.c
@@ -0,0 +1,43 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+
+#include "matrixMagnitude.h"
+
+int8 i8magna(int8* in, int rows, int cols){
+ int i=0,j=0;
+ int8 out=0, colSum=0;
+
+ /* Other method :
+ drowsuma(in,rows,cols,temp);
+ out=max(temp,cols);
+ but we have to malloc a array */
+
+ if ((rows==1)||(cols==1)){
+ for(i=0;i<cols*rows;i++){
+ out += dmagns(in[i]);
+ }
+ }
+ else{
+ for(i=0;i<cols;i++){
+ colSum = 0;
+ for(j=0;j<rows;j++){
+ colSum += dmagns(in[i*rows+j]);
+ }
+ if (colSum>out) out=colSum;
+ }
+ }
+ return out;
+}
+
+
diff --git a/src/c/matrixOperations/magnitude/i8magns.c b/src/c/matrixOperations/magnitude/i8magns.c
new file mode 100644
index 00000000..a13ae3d6
--- /dev/null
+++ b/src/c/matrixOperations/magnitude/i8magns.c
@@ -0,0 +1,22 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+
+#include "matrixMagnitude.h"
+#include "abs.h"
+
+int8 i8magns(int8 in){
+ return i8abss(in);
+}
+
+
diff --git a/src/c/matrixOperations/magnitude/u16magna.c b/src/c/matrixOperations/magnitude/u16magna.c
new file mode 100644
index 00000000..10680c77
--- /dev/null
+++ b/src/c/matrixOperations/magnitude/u16magna.c
@@ -0,0 +1,33 @@
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+
+uint16 u16magna(uint16* in, int rows, int cols){
+ int i=0,j=0;
+ uint16 out=0, colSum=0;
+
+ /* Other method :
+ drowsuma(in,rows,cols,temp);
+ out=max(temp,cols);
+ but we have to malloc a array */
+
+ if ((rows==1)||(cols==1)){
+ for(i=0;i<cols*rows;i++){
+ out += dmagns(in[i]);
+ }
+ }
+ else{
+ for(i=0;i<cols;i++){
+ colSum = 0;
+ for(j=0;j<rows;j++){
+ colSum += dmagns(in[i*rows+j]);
+ }
+ if (colSum>out) out=colSum;
+ }
+ }
+ return out;
+}
+
+
diff --git a/src/c/matrixOperations/magnitude/u16magns.c b/src/c/matrixOperations/magnitude/u16magns.c
new file mode 100644
index 00000000..78853edc
--- /dev/null
+++ b/src/c/matrixOperations/magnitude/u16magns.c
@@ -0,0 +1,13 @@
+
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+#include "abs.h"
+
+uint16 u16magns(uint16 in){
+ return u16abss(in);
+}
+
+
diff --git a/src/c/matrixOperations/magnitude/u8magna.c b/src/c/matrixOperations/magnitude/u8magna.c
new file mode 100644
index 00000000..7f5df582
--- /dev/null
+++ b/src/c/matrixOperations/magnitude/u8magna.c
@@ -0,0 +1,33 @@
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+
+uint8 u8magna(uint8* in, int rows, int cols){
+ int i=0,j=0;
+ uint8 out=0, colSum=0;
+
+ /* Other method :
+ drowsuma(in,rows,cols,temp);
+ out=max(temp,cols);
+ but we have to malloc a array */
+
+ if ((rows==1)||(cols==1)){
+ for(i=0;i<cols*rows;i++){
+ out += dmagns(in[i]);
+ }
+ }
+ else{
+ for(i=0;i<cols;i++){
+ colSum = 0;
+ for(j=0;j<rows;j++){
+ colSum += dmagns(in[i*rows+j]);
+ }
+ if (colSum>out) out=colSum;
+ }
+ }
+ return out;
+}
+
+
diff --git a/src/c/matrixOperations/magnitude/u8magns.c b/src/c/matrixOperations/magnitude/u8magns.c
new file mode 100644
index 00000000..e6d789ca
--- /dev/null
+++ b/src/c/matrixOperations/magnitude/u8magns.c
@@ -0,0 +1,13 @@
+
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+#include "abs.h"
+
+uint8 u8magns(uint8 in){
+ return u8abss(in);
+}
+
+
diff --git a/src/c/matrixOperations/matrix/dmatrixa.c b/src/c/matrixOperations/matrix/dmatrixa.c
new file mode 100644
index 00000000..649dbc34
--- /dev/null
+++ b/src/c/matrixOperations/matrix/dmatrixa.c
@@ -0,0 +1,33 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "matrix.h"
+#include "types.h"
+#include "uint16.h"
+
+void dmatrixa(double *in, int irow, int icolumn, int orow, int ocolumn ,double *out)
+{
+ int i;
+ if(irow*icolumn==orow*ocolumn)
+ {
+ for(i=0;i<irow*icolumn ; i++)
+ {
+ out[i]=in[i];
+ }
+ }
+ else
+ {
+ printf("The given dimensions are not valid for matrix reshaping");
+ }
+}
diff --git a/src/c/matrixOperations/matrix/smatrixa.c b/src/c/matrixOperations/matrix/smatrixa.c
new file mode 100644
index 00000000..f432023a
--- /dev/null
+++ b/src/c/matrixOperations/matrix/smatrixa.c
@@ -0,0 +1,33 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "matrix.h"
+#include "types.h"
+#include "uint16.h"
+
+void smatrixa(float *in, int irow, int icolumn, int orow, int ocolumn ,float *out)
+{
+ int i;
+ if(irow*icolumn==orow*ocolumn)
+ {
+ for(i=0;i<irow*icolumn ; i++)
+ {
+ out[i]=in[i];
+ }
+ }
+ else
+ {
+ printf("The given dimensions are not valid for matrix reshaping");
+ }
+}
diff --git a/src/c/matrixOperations/matrix/u16matrixa.c b/src/c/matrixOperations/matrix/u16matrixa.c
new file mode 100644
index 00000000..e60d880d
--- /dev/null
+++ b/src/c/matrixOperations/matrix/u16matrixa.c
@@ -0,0 +1,33 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "matrix.h"
+#include "types.h"
+#include "uint16.h"
+
+void u16matrixa(uint16 *in, int irow, int icolumn, int orow, int ocolumn ,uint16 *out)
+{
+ int i;
+ if(irow*icolumn==orow*ocolumn)
+ {
+ for(i=0;i<irow*icolumn ; i++)
+ {
+ out[i]=in[i];
+ }
+ }
+ else
+ {
+ printf("The given dimensions are not valid for matrix reshaping");
+ }
+}
diff --git a/src/c/matrixOperations/matrix/zmatrixa.c b/src/c/matrixOperations/matrix/zmatrixa.c
new file mode 100644
index 00000000..5e5651b1
--- /dev/null
+++ b/src/c/matrixOperations/matrix/zmatrixa.c
@@ -0,0 +1,33 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "matrix.h"
+#include "types.h"
+#include "doubleComplex.h"
+
+void zmatrixa(doubleComplex *in, int irow, int icolumn, int orow, int ocolumn ,doubleComplex *out)
+{
+ int i;
+ if(irow*icolumn==orow*ocolumn)
+ {
+ for(i=0;i<irow*icolumn ; i++)
+ {
+ out[i]=in[i];
+ }
+ }
+ else
+ {
+ printf("The given dimensions are not valid for matrix reshaping");
+ }
+}
diff --git a/src/c/matrixOperations/multiplication/i16mulma.c b/src/c/matrixOperations/multiplication/i16mulma.c
new file mode 100644
index 00000000..ba46e8e6
--- /dev/null
+++ b/src/c/matrixOperations/multiplication/i16mulma.c
@@ -0,0 +1,54 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*
+** \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/src/c/matrixOperations/multiplication/i8mulma.c b/src/c/matrixOperations/multiplication/i8mulma.c
new file mode 100644
index 00000000..88f192d7
--- /dev/null
+++ b/src/c/matrixOperations/multiplication/i8mulma.c
@@ -0,0 +1,54 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*
+** \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/src/c/matrixOperations/multiplication/u16mulma.c b/src/c/matrixOperations/multiplication/u16mulma.c
new file mode 100644
index 00000000..b15d8441
--- /dev/null
+++ b/src/c/matrixOperations/multiplication/u16mulma.c
@@ -0,0 +1,54 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*
+** \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/src/c/matrixOperations/multiplication/u8mulma.c b/src/c/matrixOperations/multiplication/u8mulma.c
new file mode 100644
index 00000000..fa4f8518
--- /dev/null
+++ b/src/c/matrixOperations/multiplication/u8mulma.c
@@ -0,0 +1,54 @@
+/* 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: Mushir
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*
+** \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;
+
+ }
+
+}
diff --git a/src/c/matrixOperations/ndgrid/dndgrida.c b/src/c/matrixOperations/ndgrid/dndgrida.c
new file mode 100644
index 00000000..d0c1ee0a
--- /dev/null
+++ b/src/c/matrixOperations/ndgrid/dndgrida.c
@@ -0,0 +1,31 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "ndgrid.h"
+
+void dndgrida(double* inp1, int size1, double* inp2, int size2, double* out1, double* out2)
+{
+ for(int i = 0; i < size2; i++)
+ {
+ for(int j = 0; j < size1; j++)
+ out1[j + i*size1] = inp1[j];
+ }
+
+ for(int i = 0; i < size2; i++)
+ {
+ for(int j = 0; j < size1; j++)
+ out2[j + i*size1] = inp2[i];
+ }
+}
diff --git a/src/c/matrixOperations/ndgrid/sndgrida.c b/src/c/matrixOperations/ndgrid/sndgrida.c
new file mode 100644
index 00000000..355d85e9
--- /dev/null
+++ b/src/c/matrixOperations/ndgrid/sndgrida.c
@@ -0,0 +1,32 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "ndgrid.h"
+
+void sndgrida(float* inp1, int size1, float* inp2, int size2, float* out1, float* out2)
+{
+ for(int i = 0; i < size2; i++)
+ {
+ for(int j = 0; j < size1; j++)
+ out1[j + i*size1] = inp1[j];
+ }
+
+ for(int i = 0; i < size2; i++)
+ {
+ for(int j = 0; j < size1; j++)
+ out2[j + i*size1] = inp2[i];
+ }
+
+}
diff --git a/src/c/matrixOperations/ndgrid/zndgrida.c b/src/c/matrixOperations/ndgrid/zndgrida.c
new file mode 100644
index 00000000..28360e20
--- /dev/null
+++ b/src/c/matrixOperations/ndgrid/zndgrida.c
@@ -0,0 +1,39 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "ndgrid.h"
+#include "doubleComplex.h"
+
+void zndgrida(doubleComplex* inp1, int size1, doubleComplex* inp2, int size2, doubleComplex* out1, doubleComplex* out2)
+{
+ for(int i = 0; i < size2; i++)
+ {
+ for(int j = 0; j < size1; j++)
+ {
+ (out1[j + i*size1]) = (inp1[j]);
+ (out1[j + i*size1]) = (inp1[j]);
+ }
+ }
+
+ for(int i = 0; i < size2; i++)
+ {
+ for(int j = 0; j < size1; j++)
+ {
+ (out2[j + i*size1]) = (inp2[i]);
+ (out2[j + i*size1]) = (inp2[i]);
+ }
+ }
+
+}
diff --git a/src/c/matrixOperations/nnz/dnnza.c b/src/c/matrixOperations/nnz/dnnza.c
new file mode 100644
index 00000000..b4d40bd8
--- /dev/null
+++ b/src/c/matrixOperations/nnz/dnnza.c
@@ -0,0 +1,33 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "nnz.h"
+#include "types.h"
+#include "uint16.h"
+
+uint16 dnnza(double *in, int irow, int icolumn)
+{
+ int i;
+ uint16 final=0;
+ for(i=0; i< irow*icolumn ; i++)
+ {
+ if( in[i] != 0)
+ {
+ final++;
+
+ }
+
+ }
+return final;
+}
diff --git a/src/c/matrixOperations/nnz/dnnzs.c b/src/c/matrixOperations/nnz/dnnzs.c
new file mode 100644
index 00000000..c878d331
--- /dev/null
+++ b/src/c/matrixOperations/nnz/dnnzs.c
@@ -0,0 +1,25 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "nnz.h"
+#include "types.h"
+#include "uint16.h"
+
+uint16 dnnzs(double in)
+{
+ if(in !=0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/src/c/matrixOperations/nnz/snnza.c b/src/c/matrixOperations/nnz/snnza.c
new file mode 100644
index 00000000..df27f0fe
--- /dev/null
+++ b/src/c/matrixOperations/nnz/snnza.c
@@ -0,0 +1,33 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "nnz.h"
+#include "types.h"
+#include "uint16.h"
+
+uint16 snnza(float*in, int irow, int icolumn)
+{
+ int i;
+ uint16 final=0;
+ for(i=0; i< irow*icolumn ; i++)
+ {
+ if( in[i] != 0)
+ {
+ final++;
+
+ }
+
+ }
+return final;
+}
diff --git a/src/c/matrixOperations/nnz/snnzs.c b/src/c/matrixOperations/nnz/snnzs.c
new file mode 100644
index 00000000..674d4fac
--- /dev/null
+++ b/src/c/matrixOperations/nnz/snnzs.c
@@ -0,0 +1,25 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "nnz.h"
+#include "types.h"
+#include "uint16.h"
+
+uint16 snnzs(float in)
+{
+ if(in !=0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/src/c/matrixOperations/nnz/znnza.c b/src/c/matrixOperations/nnz/znnza.c
new file mode 100644
index 00000000..3b913e8b
--- /dev/null
+++ b/src/c/matrixOperations/nnz/znnza.c
@@ -0,0 +1,33 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "nnz.h"
+#include "types.h"
+#include "uint16.h"
+#include "doubleComplex.h"
+uint16 znnza(doubleComplex* in, int irow, int icolumn)
+{
+ int i;
+ uint16 final=0;
+ for(i=0; i< irow*icolumn ; i++)
+ {
+ if(( zreals(in[i]) !=0 )||( zimags(in[i])!=0))
+ {
+ final++;
+
+ }
+
+ }
+return final;
+}
diff --git a/src/c/matrixOperations/nnz/znnzs.c b/src/c/matrixOperations/nnz/znnzs.c
new file mode 100644
index 00000000..2907afcf
--- /dev/null
+++ b/src/c/matrixOperations/nnz/znnzs.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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*Function returns cumulative sum of members of array/matrix*/
+
+#include "nnz.h"
+#include "types.h"
+#include "uint16.h"
+#include "doubleComplex.h"
+
+uint16 znnzs(doubleComplex in)
+{
+ if((zreals(in)== 0 ) && (zimags(in)==0))
+ return 0;
+ else
+ return 1;
+}
diff --git a/src/c/matrixOperations/norm/dnorma.c b/src/c/matrixOperations/norm/dnorma.c
new file mode 100644
index 00000000..2bb9b8b7
--- /dev/null
+++ b/src/c/matrixOperations/norm/dnorma.c
@@ -0,0 +1,80 @@
+ /* 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
+
+ Edited by: Sandeep Gupta
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+ /*This function calculates norms for matrices*/
+ /*Acceptable norms are: 1, 2, 'inf', 'fro', */
+
+#include "norm.h"
+#include "svd.h"
+#include <math.h>
+#include <stdio.h>
+#include<stdlib.h>
+
+double dnorma (double *in, int row, int col, int norm)
+{
+ double res = 0, sum = 0;
+ int col_count, row_count;
+ double *S;
+ S = (double *)malloc(min(row,col)*sizeof(double));
+ switch (norm)
+ {
+ case 1: /*largest column sum*/
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ sum = 0;
+ for(row_count = 0; row_count < row; row_count++)
+ {
+ sum += in[col_count*row+row_count];
+ }
+ if (sum >= res)
+ res = sum;
+ }
+ break;
+
+ case 2: /*Largest singular value of the matrix*/
+ dsvda(0,in,row,col,0,1,S,NULL,NULL);
+ res = S[0];
+ break;
+
+ case 3: /*inf: largest row sum*/
+
+ for(row_count = 0; row_count < row; row_count++)
+ {
+ sum = 0;
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ sum += in[col_count*row + row_count];
+ }
+ if(sum >= res)
+ res = sum;
+ }
+ break;
+
+ case 4: /*Frobenius norm*/
+
+ for(row_count = 0; row_count < row; row_count++)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ sum += in[col_count*row + row_count] * in[col_count*row + row_count];
+ }
+ }
+ res = sqrt(sum);
+
+ break;
+ }
+
+
+ return res;
+}
diff --git a/src/c/matrixOperations/norm/dnormv.c b/src/c/matrixOperations/norm/dnormv.c
new file mode 100644
index 00000000..5d20d606
--- /dev/null
+++ b/src/c/matrixOperations/norm/dnormv.c
@@ -0,0 +1,60 @@
+ /* 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
+ */
+
+ /*This function calculates norms for vectors (row or column)*/
+
+#include "norm.h"
+#include <math.h>
+
+double dnormv (double *in, int size, int norm)
+{
+ double sum = 0;
+ double res = 0;
+ int counter = 0;
+
+ switch (norm)
+ {
+ case 0:
+ res = INFINITY;
+ break;
+ case 1: /*Addition of all elements*/
+ for (counter=0; counter < size; counter++)
+ {
+ sum += in[counter];
+ }
+ res = sum;
+ break;
+ case 2: /*Square root of addition of squares of all elements*/
+ for (counter=0; counter < size; counter++)
+ {
+ sum += in[counter]*in[counter];
+ }
+ res = sqrt(sum);
+ break;
+ case 3: /*Cube root of addition of cubes of all elements*/
+ for (counter=0; counter < size; counter++)
+ {
+ sum += pow(in[counter],3);
+ }
+ res = cbrt(sum);
+ break;
+ default : /*Nth root of addition of all elements raised to n*/
+ for (counter=0; counter < size; counter++)
+ {
+ sum += pow(in[counter],norm);
+ }
+ res = pow(sum, 1./norm);
+ break;
+ }
+
+ return res;
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/norm/snorma.c b/src/c/matrixOperations/norm/snorma.c
new file mode 100644
index 00000000..4bf2ccda
--- /dev/null
+++ b/src/c/matrixOperations/norm/snorma.c
@@ -0,0 +1,72 @@
+ /* 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
+ */
+
+ /*This function calculates norms for matrices*/
+ /*Acceptable norms are: 1, 2, 'inf', 'fro', */
+
+#include "norm.h"
+#include <math.h>
+
+float dnorma (float *in, int row, int col, int norm)
+{
+ float res = 0, sum = 0;
+ int col_count, row_count;
+
+ switch (norm)
+ {
+ case 1: /*largest column sum*/
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ sum = 0;
+ for(row_count = 0; row_count < row; row_count++)
+ {
+ sum += in[col_count*row+row_count];
+ }
+ if (sum >= res)
+ res = sum;
+ }
+ break;
+
+ case 2: /*Largest singular value of the matrix*/
+ break;
+
+ case 3: /*inf: largest row sum*/
+
+ for(row_count = 0; row_count < row; row_count++)
+ {
+ sum = 0;
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ sum += in[col_count*row + row_count];
+ }
+ if(sum >= res)
+ res = sum;
+ }
+ break;
+
+ case 4: /*Frobenius norm*/
+
+ for(row_count = 0; row_count < row; row_count++)
+ {
+ for(col_count = 0; col_count < col; col_count++)
+ {
+ sum += in[col_count*row + row_count] * in[col_count*row + row_count];
+ }
+ }
+ res = sqrt(sum);
+
+ break;
+ }
+
+
+ return res;
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/norm/snormv.c b/src/c/matrixOperations/norm/snormv.c
new file mode 100644
index 00000000..03e9ed66
--- /dev/null
+++ b/src/c/matrixOperations/norm/snormv.c
@@ -0,0 +1,60 @@
+ /* 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
+ */
+
+ /*This function calculates norms for vectors (row or column)*/
+
+#include "norm.h"
+#include <math.h>
+
+float dnormv (float *in, int size, int norm)
+{
+ float sum = 0;
+ float res = 0;
+ int counter = 0;
+
+ switch (norm)
+ {
+ case 0:
+ res = INFINITY;
+ break;
+ case 1: /*Addition of all elements*/
+ for (counter=0; counter < size; counter++)
+ {
+ sum += in[counter];
+ }
+ res = sum;
+ break;
+ case 2: /*Square root of addition of squares of all elements*/
+ for (counter=0; counter < size; counter++)
+ {
+ sum += in[counter]*in[counter];
+ }
+ res = sqrt(sum);
+ break;
+ case 3: /*Cube root of addition of cubes of all elements*/
+ for (counter=0; counter < size; counter++)
+ {
+ sum += pow(in[counter],3);
+ }
+ res = cbrt(sum);
+ break;
+ default : /*Nth root of addition of all elements raised to n*/
+ for (counter=0; counter < size; counter++)
+ {
+ sum += pow(in[counter],norm);
+ }
+ res = pow(sum, 1./norm);
+ break;
+ }
+
+ return res;
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/ones/i16onesa.c b/src/c/matrixOperations/ones/i16onesa.c
new file mode 100644
index 00000000..d8dee192
--- /dev/null
+++ b/src/c/matrixOperations/ones/i16onesa.c
@@ -0,0 +1,28 @@
+/* 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 "ones.h"
+
+void i16onesa ( int16* in , int rows , int cols )
+{
+ int i = 0 ;
+
+ for ( i = 0 ; i < rows*cols ; i++)
+ {
+ in[i] = (int16)1 ;
+
+ }
+
+}
+
+
+
diff --git a/src/c/matrixOperations/ones/i8onesa.c b/src/c/matrixOperations/ones/i8onesa.c
new file mode 100644
index 00000000..11b48bf2
--- /dev/null
+++ b/src/c/matrixOperations/ones/i8onesa.c
@@ -0,0 +1,28 @@
+/* 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 "ones.h"
+
+void i8onesa ( int8* in , int rows , int cols )
+{
+ int i = 0 ;
+
+ for ( i = 0 ; i < rows*cols ; i++)
+ {
+ in[i] = (int8)1 ;
+
+ }
+
+}
+
+
+
diff --git a/src/c/matrixOperations/ones/u16onesa.c b/src/c/matrixOperations/ones/u16onesa.c
new file mode 100644
index 00000000..e91b5a72
--- /dev/null
+++ b/src/c/matrixOperations/ones/u16onesa.c
@@ -0,0 +1,28 @@
+/* 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 "ones.h"
+
+void u16onesa ( uint16* in , int rows , int cols )
+{
+ int i = 0 ;
+
+ for ( i = 0 ; i < rows*cols ; i++)
+ {
+ in[i] = (uint16)1 ;
+
+ }
+
+}
+
+
+
diff --git a/src/c/matrixOperations/ones/u8onesa.c b/src/c/matrixOperations/ones/u8onesa.c
new file mode 100644
index 00000000..be9a1bf3
--- /dev/null
+++ b/src/c/matrixOperations/ones/u8onesa.c
@@ -0,0 +1,28 @@
+/* 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 "ones.h"
+
+void u8onesa ( uint8* in , int rows , int cols )
+{
+ int i = 0 ;
+
+ for ( i = 0 ; i < rows*cols ; i++)
+ {
+ in[i] = (uint8)1 ;
+
+ }
+
+}
+
+
+
diff --git a/src/c/matrixOperations/pertrans/dpertransa.c b/src/c/matrixOperations/pertrans/dpertransa.c
new file mode 100644
index 00000000..36b963ec
--- /dev/null
+++ b/src/c/matrixOperations/pertrans/dpertransa.c
@@ -0,0 +1,36 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "pertrans.h"
+#include "types.h"
+#include "matrixTranspose.h"
+
+void dpertransa(double *in, int row, int col, double* out)
+{
+
+ double middle[row*col];
+ int j=0;
+
+ dtransposea(in, row, col, middle);
+
+ for(int i= row*col-1; i>=0; i=i-1)
+ {
+
+ out[j]= middle[i];
+ j=j+1;
+
+ }
+
+
+
+
+}
diff --git a/src/c/matrixOperations/pertrans/dpertranss.c b/src/c/matrixOperations/pertrans/dpertranss.c
new file mode 100644
index 00000000..10c2d036
--- /dev/null
+++ b/src/c/matrixOperations/pertrans/dpertranss.c
@@ -0,0 +1,23 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "pertrans.h"
+#include "types.h"
+#include "matrixTranspose.h"
+
+double dpertranss(double in)
+{
+
+ return in;
+
+
+}
diff --git a/src/c/matrixOperations/pertrans/spertransa.c b/src/c/matrixOperations/pertrans/spertransa.c
new file mode 100644
index 00000000..4eba2f16
--- /dev/null
+++ b/src/c/matrixOperations/pertrans/spertransa.c
@@ -0,0 +1,36 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "pertrans.h"
+#include "types.h"
+#include "matrixTranspose.h"
+
+void spertransa(float *in, int row, int col, float* out)
+{
+
+ float middle[row*col];
+ int j=0;
+
+ stransposea(in, row, col, middle);
+
+ for(int i= row*col-1; i>=0; i=i-1)
+ {
+
+ out[j]= middle[i];
+ j=j+1;
+
+ }
+
+
+
+
+}
diff --git a/src/c/matrixOperations/pertrans/spertranss.c b/src/c/matrixOperations/pertrans/spertranss.c
new file mode 100644
index 00000000..694c2317
--- /dev/null
+++ b/src/c/matrixOperations/pertrans/spertranss.c
@@ -0,0 +1,23 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "pertrans.h"
+#include "types.h"
+#include "matrixTranspose.h"
+
+float spertranss(float in)
+{
+
+ return in;
+
+
+}
diff --git a/src/c/matrixOperations/pertrans/zpertransa.c b/src/c/matrixOperations/pertrans/zpertransa.c
new file mode 100644
index 00000000..c52fdbc0
--- /dev/null
+++ b/src/c/matrixOperations/pertrans/zpertransa.c
@@ -0,0 +1,37 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "pertrans.h"
+#include "types.h"
+#include "matrixTranspose.h"
+#include "doubleComplex.h"
+
+void zpertransa(doubleComplex *in, int row, int col, doubleComplex* out)
+{
+
+ doubleComplex middle[row*col];
+ int j=0;
+
+ ztransposea(in, row, col, middle);
+
+ for(int i= row*col-1; i>=0; i=i-1)
+ {
+
+ out[j]= middle[i];
+ j=j+1;
+
+ }
+
+
+
+
+}
diff --git a/src/c/matrixOperations/pertrans/zpertranss.c b/src/c/matrixOperations/pertrans/zpertranss.c
new file mode 100644
index 00000000..73e6e618
--- /dev/null
+++ b/src/c/matrixOperations/pertrans/zpertranss.c
@@ -0,0 +1,24 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "pertrans.h"
+#include "types.h"
+#include "matrixTranspose.h"
+#include "doubleComplex.h"
+
+doubleComplex zpertranss(doubleComplex in)
+{
+
+ return in;
+
+
+}
diff --git a/src/c/matrixOperations/toeplitz/ctoeplitza.c b/src/c/matrixOperations/toeplitz/ctoeplitza.c
new file mode 100644
index 00000000..56c3ef84
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/ctoeplitza.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include "toeplitz.h"
+#include "floatComplex.h"
+#include "stdlib.h"
+#include "string.h"
+#include "cat.h"
+
+/*Function to build a Toeplitz Matrix for inputs of SingleComplex datatype*/
+
+void ctoeplitza(floatComplex* inp1,int size1,floatComplex* inp2,int size2,floatComplex* oup)
+{
+ if ((creals(inp1[0])!=creals(inp2[0]))&&(cimags(inp1[0])!=cimags(inp2[0])))
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = FloatComplex(0,0); // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (creals(oup[i]) == 0 && cimags(oup[i]) == 0)
+ oup[i] = oup[i-size2-1];
+ }
+}
+
+
diff --git a/src/c/matrixOperations/toeplitz/dtoeplitza.c b/src/c/matrixOperations/toeplitz/dtoeplitza.c
new file mode 100644
index 00000000..ef075a9a
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/dtoeplitza.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include "toeplitz.h"
+
+
+/*Function to build a Toeplitz Matrix for inputs of Double datatype*/
+
+
+void dtoeplitza(double* inp1,int size1,double* inp2,int size2,double* oup)
+{
+ if (inp1[0]!=inp2[0])
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (oup[i] == 0)
+ oup[i] = oup[i-size2-1];
+ }
+}
+
diff --git a/src/c/matrixOperations/toeplitz/gtoeplitza.c b/src/c/matrixOperations/toeplitz/gtoeplitza.c
new file mode 100644
index 00000000..c852f92f
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/gtoeplitza.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include "toeplitz.h"
+
+
+/*Function to build a Toeplitz Matrix for inputs of Character datatype*/
+
+
+void gtoeplitza(char* inp1,int size1,char* inp2,int size2,char* oup)
+{
+ if (inp1[0]!=inp2[0])
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (oup[i] == 0)
+ oup[i] = oup[i-size2-1];
+ }
+
+}
+
+
diff --git a/src/c/matrixOperations/toeplitz/i16toeplitza.c b/src/c/matrixOperations/toeplitz/i16toeplitza.c
new file mode 100644
index 00000000..945f626e
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/i16toeplitza.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include "toeplitz.h"
+#include "int16.h"
+
+/*Function to build a Toeplitz Matrix for inputs of Signed Int16 datatype*/
+
+
+void i16toeplitza(int16* inp1,int size1,int16* inp2,int size2,int16* oup)
+{
+ if (inp1[0]!=inp2[0])
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (oup[i] == 0)
+ oup[i] = oup[i-size2-1];
+ }
+}
diff --git a/src/c/matrixOperations/toeplitz/i8toeplitza.c b/src/c/matrixOperations/toeplitz/i8toeplitza.c
new file mode 100644
index 00000000..5075cc13
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/i8toeplitza.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include "toeplitz.h"
+#include "int8.h"
+
+
+/*Function to build a Toeplitz Matrix for inputs of Signed Int8 datatype*/
+
+
+void i8toeplitza(int8* inp1,int size1,int8* inp2,int size2,int8* oup)
+{
+ if (inp1[0]!=inp2[0])
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (oup[i] == 0)
+ oup[i] = oup[i-size2-1];
+ }
+}
diff --git a/src/c/matrixOperations/toeplitz/stoeplitza.c b/src/c/matrixOperations/toeplitz/stoeplitza.c
new file mode 100644
index 00000000..11d91ce1
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/stoeplitza.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include "toeplitz.h"
+
+
+/*Function to build a Toeplitz Matrix for inputs of Float datatype*/
+
+
+void stoeplitza(float* inp1,int size1,float* inp2,int size2,float* oup)
+{
+ if (inp1[0]!=inp2[0])
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (oup[i] == 0)
+ oup[i] = oup[i-size2-1];
+ }
+}
diff --git a/src/c/matrixOperations/toeplitz/u16toeplitza.c b/src/c/matrixOperations/toeplitz/u16toeplitza.c
new file mode 100644
index 00000000..8dab5452
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/u16toeplitza.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include "toeplitz.h"
+#include "uint16.h"
+
+
+/*Function to build a Toeplitz Matrix for inputs of Unsigned Int16 datatype*/
+
+
+void u16toeplitza(uint16* inp1,int size1,uint16* inp2,int size2,uint16* oup)
+{
+ if (inp1[0]!=inp2[0])
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (oup[i] == 0)
+ oup[i] = oup[i-size2-1];
+ }
+}
diff --git a/src/c/matrixOperations/toeplitz/u8toeplitza.c b/src/c/matrixOperations/toeplitz/u8toeplitza.c
new file mode 100644
index 00000000..8301fc16
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/u8toeplitza.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include "toeplitz.h"
+#include "uint8.h"
+
+
+/*Function to build a Toeplitz Matrix for inputs of Unsigned Int8 datatype*/
+
+
+void u8toeplitza(uint8* inp1,int size1,uint8* inp2,int size2,uint8* oup)
+{
+ if (inp1[0]!=inp2[0])
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (oup[i] == 0)
+ oup[i] = oup[i-size2-1];
+ }
+}
diff --git a/src/c/matrixOperations/toeplitz/ztoeplitza.c b/src/c/matrixOperations/toeplitz/ztoeplitza.c
new file mode 100644
index 00000000..117f8189
--- /dev/null
+++ b/src/c/matrixOperations/toeplitz/ztoeplitza.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include "toeplitz.h"
+#include "doubleComplex.h"
+#include "stdlib.h"
+#include "string.h"
+#include "cat.h"
+
+
+/*Function to build a Toeplitz Matrix for inputs of DoubleComplex datatype*/
+
+
+void ztoeplitza(doubleComplex* inp1,int size1,doubleComplex* inp2,int size2,doubleComplex* oup)
+{
+ if ((zreals(inp1[0])!=zreals(inp2[0]))&&(zimags(inp1[0])!=zimags(inp2[0])))
+ {
+ printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz.
+ return;
+ }
+ int i, j;
+
+ for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros.
+
+ for (i = 0; i<size1; i++)
+ {
+ for (j = 0; j<size2; j++)
+ {
+ oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix.
+ }
+ oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix.
+ }
+ for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix.
+ {
+ if (zreals(oup[i]) == 0 && zimags(oup[i]) == 0)
+ oup[i] = oup[i-size2-1];
+ }
+}
diff --git a/src/c/matrixOperations/trace/i16tracea.c b/src/c/matrixOperations/trace/i16tracea.c
new file mode 100644
index 00000000..3aeec4e1
--- /dev/null
+++ b/src/c/matrixOperations/trace/i16tracea.c
@@ -0,0 +1,28 @@
+/* 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 "matrixTrace.h"
+
+int16 i16tracea ( int16* in ,int lines){
+
+
+ int i = 0 ;
+ //double out = 0 ;
+ int16 out = 0;
+
+ for ( i = 0 ; i < lines ; ++i)
+ out += (int16)in[i*lines + i] ;
+
+ return out;
+}
+
+
diff --git a/src/c/matrixOperations/trace/i8tracea.c b/src/c/matrixOperations/trace/i8tracea.c
new file mode 100644
index 00000000..9158ba45
--- /dev/null
+++ b/src/c/matrixOperations/trace/i8tracea.c
@@ -0,0 +1,28 @@
+/* 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 "matrixTrace.h"
+
+int8 i8tracea ( int8* in ,int lines){
+
+
+ int i = 0 ;
+ //double out = 0 ;
+ int8 out = 0;
+
+ for ( i = 0 ; i < lines ; ++i)
+ out += (int8)in[i*lines + i] ;
+
+ return out;
+}
+
+
diff --git a/src/c/matrixOperations/trace/u16tracea.c b/src/c/matrixOperations/trace/u16tracea.c
new file mode 100644
index 00000000..2a85fa30
--- /dev/null
+++ b/src/c/matrixOperations/trace/u16tracea.c
@@ -0,0 +1,28 @@
+/* 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 "matrixTrace.h"
+
+uint16 u16tracea ( uint16* in ,int lines){
+
+
+ int i = 0 ;
+ //double out = 0 ;
+ uint16 out = 0;
+
+ for ( i = 0 ; i < lines ; ++i)
+ out += (uint16)in[i*lines + i] ;
+
+ return out;
+}
+
+
diff --git a/src/c/matrixOperations/trace/u8tracea.c b/src/c/matrixOperations/trace/u8tracea.c
new file mode 100644
index 00000000..2823f6d4
--- /dev/null
+++ b/src/c/matrixOperations/trace/u8tracea.c
@@ -0,0 +1,28 @@
+/* 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 "matrixTrace.h"
+
+uint8 u8tracea ( uint8* in ,int lines){
+
+
+ int i = 0 ;
+ //double out = 0 ;
+ uint8 out = 0;
+
+ for ( i = 0 ; i < lines ; ++i)
+ out += (uint8)in[i*lines + i] ;
+
+ return out;
+}
+
+
diff --git a/src/c/matrixOperations/transpose/i16transposea.c b/src/c/matrixOperations/transpose/i16transposea.c
new file mode 100644
index 00000000..e370c636
--- /dev/null
+++ b/src/c/matrixOperations/transpose/i16transposea.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 "matrixTranspose.h"
+
+void i16transposea ( int16* in , int lines , int columns, int16* out ){
+
+ int i = 0 ;
+ int j = 0 ;
+
+ for(i = 0 ; i < lines ; i++)
+ {
+ for(j = 0 ; j < columns ; j++)
+
+ out[j+i*columns] = (int16)in[i+j*lines];
+ }
+
+}
diff --git a/src/c/matrixOperations/transpose/i8transposea.c b/src/c/matrixOperations/transpose/i8transposea.c
new file mode 100644
index 00000000..a05ee064
--- /dev/null
+++ b/src/c/matrixOperations/transpose/i8transposea.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 "matrixTranspose.h"
+
+void i8transposea ( int8* in , int lines , int columns, int8* out ){
+
+ int i = 0 ;
+ int j = 0 ;
+
+ for(i = 0 ; i < lines ; i++)
+ {
+ for(j = 0 ; j < columns ; j++)
+
+ out[j+i*columns] = (int8)in[i+j*lines];
+ }
+
+}
diff --git a/src/c/matrixOperations/transpose/u16transposea.c b/src/c/matrixOperations/transpose/u16transposea.c
new file mode 100644
index 00000000..8bf659df
--- /dev/null
+++ b/src/c/matrixOperations/transpose/u16transposea.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 "matrixTranspose.h"
+
+void u16transposea ( uint16* in , int lines , int columns, uint16* out ){
+
+ int i = 0 ;
+ int j = 0 ;
+
+ for(i = 0 ; i < lines ; i++)
+ {
+ for(j = 0 ; j < columns ; j++)
+
+ out[j+i*columns] = (uint16)in[i+j*lines];
+ }
+
+}
diff --git a/src/c/matrixOperations/transpose/u8transposea.c b/src/c/matrixOperations/transpose/u8transposea.c
new file mode 100644
index 00000000..54b53324
--- /dev/null
+++ b/src/c/matrixOperations/transpose/u8transposea.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 "matrixTranspose.h"
+
+void u8transposea ( uint8* in , int lines , int columns, uint8* out ){
+
+ int i = 0 ;
+ int j = 0 ;
+
+ for(i = 0 ; i < lines ; i++)
+ {
+ for(j = 0 ; j < columns ; j++)
+
+ out[j+i*columns] = (uint8)in[i+j*lines];
+ }
+
+}
diff --git a/src/c/matrixOperations/tril/dtrila.c b/src/c/matrixOperations/tril/dtrila.c
new file mode 100644
index 00000000..b45c85fb
--- /dev/null
+++ b/src/c/matrixOperations/tril/dtrila.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "tril.h"
+
+void dtrila (double *in, int row, int column, double diag, double *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) >= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/tril/i16trila.c b/src/c/matrixOperations/tril/i16trila.c
new file mode 100644
index 00000000..98174d90
--- /dev/null
+++ b/src/c/matrixOperations/tril/i16trila.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "tril.h"
+
+void i16trila (int16 *in, int row, int column, double diag, int16 *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) >= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/tril/i8trila.c b/src/c/matrixOperations/tril/i8trila.c
new file mode 100644
index 00000000..d06b2aad
--- /dev/null
+++ b/src/c/matrixOperations/tril/i8trila.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "tril.h"
+
+void i8trila (int8 *in, int row, int column, double diag, int8 *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) >= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/tril/strila.c b/src/c/matrixOperations/tril/strila.c
new file mode 100644
index 00000000..bc7f1f2f
--- /dev/null
+++ b/src/c/matrixOperations/tril/strila.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "tril.h"
+
+void strila (float *in, int row, int column, double diag, float *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) >= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/tril/u16trila.c b/src/c/matrixOperations/tril/u16trila.c
new file mode 100644
index 00000000..418a595e
--- /dev/null
+++ b/src/c/matrixOperations/tril/u16trila.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "tril.h"
+
+void u16trila (uint16 *in, int row, int column, double diag, uint16 *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) >= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/tril/u8trila.c b/src/c/matrixOperations/tril/u8trila.c
new file mode 100644
index 00000000..5c21d88e
--- /dev/null
+++ b/src/c/matrixOperations/tril/u8trila.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "tril.h"
+
+void u8trila (uint8 *in, int row, int column, double diag, uint8 *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) >= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/triu/dtriua.c b/src/c/matrixOperations/triu/dtriua.c
new file mode 100644
index 00000000..80db14b3
--- /dev/null
+++ b/src/c/matrixOperations/triu/dtriua.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "triu.h"
+
+void dtriua (double *in, int row, int column, double diag, double *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) <= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/triu/i16triua.c b/src/c/matrixOperations/triu/i16triua.c
new file mode 100644
index 00000000..a4a0e9f3
--- /dev/null
+++ b/src/c/matrixOperations/triu/i16triua.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "triu.h"
+
+void i16triua (int16 *in, int row, int column, double diag, int16 *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) <= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/triu/i8triua.c b/src/c/matrixOperations/triu/i8triua.c
new file mode 100644
index 00000000..c5dcee5d
--- /dev/null
+++ b/src/c/matrixOperations/triu/i8triua.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "triu.h"
+
+void i8triua (int8 *in, int row, int column, double diag, int8 *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) <= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/triu/striua.c b/src/c/matrixOperations/triu/striua.c
new file mode 100644
index 00000000..8ec779ea
--- /dev/null
+++ b/src/c/matrixOperations/triu/striua.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "triu.h"
+
+void striua (float *in, int row, int column, double diag, float *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) <= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/triu/u16triua.c b/src/c/matrixOperations/triu/u16triua.c
new file mode 100644
index 00000000..6341881b
--- /dev/null
+++ b/src/c/matrixOperations/triu/u16triua.c
@@ -0,0 +1,35 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+#include "triu.h"
+
+void u16triua (uint16 *in, int row, int column, double diag, uint16 *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) <= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/triu/u8triua.c b/src/c/matrixOperations/triu/u8triua.c
new file mode 100644
index 00000000..4637e873
--- /dev/null
+++ b/src/c/matrixOperations/triu/u8triua.c
@@ -0,0 +1,36 @@
+/* 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
+*/
+
+/*Function to extract lower triagular entries from given matrix*/
+
+
+#include "triu.h"
+
+void u8triua (uint8 *in, int row, int column, double diag, uint8 *out)
+{
+ int row_counter, col_counter = 0;
+
+ for(row_counter=0; row_counter < row; row_counter++)
+ {
+ for(col_counter=0; col_counter < column; col_counter++)
+ {
+ if((double)(row_counter + diag) <= (double)col_counter)
+ {
+ out[col_counter*row+row_counter] = in[col_counter*row+row_counter];
+ }
+ else
+ {
+ out[col_counter*row+row_counter] = 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/c/matrixOperations/zeros/i16zerosa.c b/src/c/matrixOperations/zeros/i16zerosa.c
new file mode 100644
index 00000000..13ff62b6
--- /dev/null
+++ b/src/c/matrixOperations/zeros/i16zerosa.c
@@ -0,0 +1,28 @@
+/* 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 "zeros.h"
+
+void i16zerosa ( int16* in , int rows , int cols )
+{
+ int i = 0 ;
+
+ for ( i = 0 ; i < rows*cols ; i++)
+ {
+ in[i] = (int16)0 ;
+
+ }
+
+}
+
+
+
diff --git a/src/c/matrixOperations/zeros/i8zerosa.c b/src/c/matrixOperations/zeros/i8zerosa.c
new file mode 100644
index 00000000..f8808c0a
--- /dev/null
+++ b/src/c/matrixOperations/zeros/i8zerosa.c
@@ -0,0 +1,28 @@
+/* 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 "zeros.h"
+
+void i8zerosa ( int8* in , int rows , int cols )
+{
+ int i = 0 ;
+
+ for ( i = 0 ; i < rows*cols ; i++)
+ {
+ in[i] = (int8)0 ;
+
+ }
+
+}
+
+
+
diff --git a/src/c/matrixOperations/zeros/u16zerosa.c b/src/c/matrixOperations/zeros/u16zerosa.c
new file mode 100644
index 00000000..3db1ac5a
--- /dev/null
+++ b/src/c/matrixOperations/zeros/u16zerosa.c
@@ -0,0 +1,28 @@
+/* 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 "zeros.h"
+
+void u16zerosa ( uint16* in , int rows , int cols )
+{
+ int i = 0 ;
+
+ for ( i = 0 ; i < rows*cols ; i++)
+ {
+ in[i] = (uint16)0 ;
+
+ }
+
+}
+
+
+
diff --git a/src/c/matrixOperations/zeros/u8zerosa.c b/src/c/matrixOperations/zeros/u8zerosa.c
new file mode 100644
index 00000000..ee239a67
--- /dev/null
+++ b/src/c/matrixOperations/zeros/u8zerosa.c
@@ -0,0 +1,28 @@
+/* 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 "zeros.h"
+
+void u8zerosa ( uint8* in , int rows , int cols )
+{
+ int i = 0 ;
+
+ for ( i = 0 ; i < rows*cols ; i++)
+ {
+ in[i] = (uint8)0 ;
+
+ }
+
+}
+
+
+