summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiddhu89902016-05-18 09:44:43 +0530
committersiddhu89902016-05-18 09:44:43 +0530
commita6d6a9c1e88b75668868af691c9731075a514ffb (patch)
treeac0082f5f70a279ce5d25089d328f1f872d85981
parenta9d0c72c839428a17956fa0530977fc058d8a799 (diff)
downloadscilab2c-a6d6a9c1e88b75668868af691c9731075a514ffb.tar.gz
scilab2c-a6d6a9c1e88b75668868af691c9731075a514ffb.tar.bz2
scilab2c-a6d6a9c1e88b75668868af691c9731075a514ffb.zip
Support added for kron, flipdim
-rw-r--r--includes/sci2clib.h6
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.binbin1102440 -> 1119708 bytes
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci128
-rw-r--r--macros/findDeps/getAllHeaders.binbin29200 -> 29572 bytes
-rw-r--r--macros/findDeps/getAllHeaders.sci2
-rw-r--r--macros/findDeps/getAllInterfaces.binbin30388 -> 30808 bytes
-rw-r--r--macros/findDeps/getAllInterfaces.sci2
-rw-r--r--macros/findDeps/getAllSources.binbin181184 -> 182728 bytes
-rw-r--r--macros/findDeps/getAllSources.sci8
-rw-r--r--src/c/matrixOperations/flipdim/dflipdima.c80
-rw-r--r--src/c/matrixOperations/flipdim/i16flipdima.c80
-rw-r--r--src/c/matrixOperations/flipdim/i8flipdima.c80
-rw-r--r--src/c/matrixOperations/flipdim/sflipdima.c80
-rw-r--r--src/c/matrixOperations/flipdim/u16flipdima.c80
-rw-r--r--src/c/matrixOperations/flipdim/u8flipdima.c80
-rw-r--r--src/c/matrixOperations/includes/flipdim.h39
-rw-r--r--src/c/matrixOperations/includes/kron.h31
-rw-r--r--src/c/matrixOperations/interfaces/int_flipdim.h109
-rw-r--r--src/c/matrixOperations/interfaces/int_kron.h43
-rw-r--r--src/c/matrixOperations/kron/dkrona.c38
-rw-r--r--src/c/matrixOperations/kron/skrona.c38
-rw-r--r--src/c/matrixOperations/triu/.fuse_hidden000033820000000132
22 files changed, 924 insertions, 32 deletions
diff --git a/includes/sci2clib.h b/includes/sci2clib.h
index a6f247a9..3353cf76 100644
--- a/includes/sci2clib.h
+++ b/includes/sci2clib.h
@@ -319,6 +319,12 @@
/*interfacing tril*/
#include "int_tril.h"
#include "tril.h"
+/*interfacing kron*/
+#include "int_kron.h"
+#include "kron.h"
+/*interfacing flipdim*/
+#include "int_flipdim.h"
+#include "flipdim.h"
/* SIGNAL PROCESSING */
/* interfacing convol */
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
index 42ad0ab3..6a319d99 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
+++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
Binary files differ
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index 20db53fe..caf9e32e 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -4990,6 +4990,134 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file',
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//------------------------------------
+//---- Class KRON --------------------
+//------------------------------------
+ClassName = 'KRON';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_MUL(IN(1).SZ(1),IN(2).SZ(1))',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_MUL(IN(1).SZ(2),IN(2).SZ(2))',ClassFileName,'file','y');
+
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y');
+
+PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y');
+
+PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+
+PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'kron';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class FLIPDIM -----------------
+//------------------------------------
+ClassName = 'FLIPDIM';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y');
+PrintStringInfo('u80u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('i80i80'+ArgSeparator+'i80',ClassFileName,'file','y');
+PrintStringInfo('u160u160'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('i160i160'+ArgSeparator+'i160',ClassFileName,'file','y');
+
+PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y');
+PrintStringInfo('u82u80'+ArgSeparator+'u82',ClassFileName,'file','y');
+PrintStringInfo('i82i80'+ArgSeparator+'i82',ClassFileName,'file','y');
+PrintStringInfo('u162u160'+ArgSeparator+'u162',ClassFileName,'file','y');
+PrintStringInfo('i162i160'+ArgSeparator+'i162',ClassFileName,'file','y');
+PrintStringInfo('u82d0'+ArgSeparator+'u82',ClassFileName,'file','y');
+PrintStringInfo('i82d0'+ArgSeparator+'i82',ClassFileName,'file','y');
+PrintStringInfo('u162d0'+ArgSeparator+'u162',ClassFileName,'file','y');
+PrintStringInfo('i162d0'+ArgSeparator+'i162',ClassFileName,'file','y');
+
+PrintStringInfo('d2d0d0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s2s0d0'+ArgSeparator+'s2',ClassFileName,'file','y');
+PrintStringInfo('u82u80u80'+ArgSeparator+'u82',ClassFileName,'file','y');
+PrintStringInfo('i82i80u80'+ArgSeparator+'i82',ClassFileName,'file','y');
+PrintStringInfo('u162u160u160'+ArgSeparator+'u162',ClassFileName,'file','y');
+PrintStringInfo('i162i160i160'+ArgSeparator+'i162',ClassFileName,'file','y');
+PrintStringInfo('u82d0d0'+ArgSeparator+'u82',ClassFileName,'file','y');
+PrintStringInfo('i82d0d0'+ArgSeparator+'i82',ClassFileName,'file','y');
+PrintStringInfo('u162d0d0'+ArgSeparator+'u162',ClassFileName,'file','y');
+PrintStringInfo('i162d0d0'+ArgSeparator+'i162',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'flipdim';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class PERMUTE -----------------
+//------------------------------------
+ClassName = 'PERMUTE';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d2d2'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('s0s2'+ArgSeparator+'s0',ClassFileName,'file','y');
+PrintStringInfo('u80u82'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('i80i82'+ArgSeparator+'i80',ClassFileName,'file','y');
+PrintStringInfo('u160u162'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('i160i162'+ArgSeparator+'i160',ClassFileName,'file','y');
+PrintStringInfo('s0d2'+ArgSeparator+'s0',ClassFileName,'file','y');
+PrintStringInfo('u80d2'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('i80d2'+ArgSeparator+'i80',ClassFileName,'file','y');
+PrintStringInfo('u160d2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('i160d2'+ArgSeparator+'i160',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'permute';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
// ////////////////////////////////////////////
// /////PARTE INTRODOTTA DA ALBERTO MOREA
// /////////////////////////////////////////////
diff --git a/macros/findDeps/getAllHeaders.bin b/macros/findDeps/getAllHeaders.bin
index c130ae70..9f0ca086 100644
--- a/macros/findDeps/getAllHeaders.bin
+++ b/macros/findDeps/getAllHeaders.bin
Binary files differ
diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci
index 373549e4..a8c23a15 100644
--- a/macros/findDeps/getAllHeaders.sci
+++ b/macros/findDeps/getAllHeaders.sci
@@ -68,6 +68,8 @@ function allHeaders = getAllHeaders(Target)
"src/c/matrixOperations/includes/cumprod.h"
"src/c/matrixOperations/includes/triu.h"
"src/c/matrixOperations/includes/tril.h"
+ "src/c/matrixOperations/includes/kron.h"
+ "src/c/matrixOperations/includes/flipdim.h"
"src/c/elementaryFunctions/includes/cos.h"
"src/c/elementaryFunctions/includes/fix.h"
"src/c/elementaryFunctions/includes/exp.h"
diff --git a/macros/findDeps/getAllInterfaces.bin b/macros/findDeps/getAllInterfaces.bin
index 65bccb12..0b9ed8c6 100644
--- a/macros/findDeps/getAllInterfaces.bin
+++ b/macros/findDeps/getAllInterfaces.bin
Binary files differ
diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci
index 436eb869..7574cc7f 100644
--- a/macros/findDeps/getAllInterfaces.sci
+++ b/macros/findDeps/getAllInterfaces.sci
@@ -56,6 +56,8 @@ function allInterfaces = getAllInterfaces(Target)
"src/c/matrixOperations/interfaces/int_cumprod.h"
"src/c/matrixOperations/interfaces/int_triu.h"
"src/c/matrixOperations/interfaces/int_tril.h"
+ "src/c/matrixOperations/interfaces/int_kron.h"
+ "src/c/matrixOperations/interfaces/int_flipdim.h"
"src/c/elementaryFunctions/interfaces/int_asinh.h"
"src/c/elementaryFunctions/interfaces/int_atanh.h"
"src/c/elementaryFunctions/interfaces/int_sinh.h"
diff --git a/macros/findDeps/getAllSources.bin b/macros/findDeps/getAllSources.bin
index c014aaa6..75c2b579 100644
--- a/macros/findDeps/getAllSources.bin
+++ b/macros/findDeps/getAllSources.bin
Binary files differ
diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci
index 5a88eb3d..d8730781 100644
--- a/macros/findDeps/getAllSources.sci
+++ b/macros/findDeps/getAllSources.sci
@@ -316,12 +316,20 @@ function allSources = getAllSources(Target)
"src/c/matrixOperations/triu/i8triua.c"
"src/c/matrixOperations/triu/u16triua.c"
"src/c/matrixOperations/triu/i16triua.c"
+ "src/c/matrixOperations/flipdim/dflipdima.c"
+ "src/c/matrixOperations/flipdim/sflipdima.c"
+ "src/c/matrixOperations/flipdim/u8flipdima.c"
+ "src/c/matrixOperations/flipdim/i8flipdima.c"
+ "src/c/matrixOperations/flipdim/u16flipdima.c"
+ "src/c/matrixOperations/flipdim/i16flipdima.c"
"src/c/matrixOperations/tril/dtrila.c"
"src/c/matrixOperations/tril/strila.c"
"src/c/matrixOperations/tril/u8trila.c"
"src/c/matrixOperations/tril/i8trila.c"
"src/c/matrixOperations/tril/u16trila.c"
"src/c/matrixOperations/tril/i16trila.c"
+ "src/c/matrixOperations/kron/dkrona.c"
+ "src/c/matrixOperations/kron/skrona.c"
"src/c/elementaryFunctions/cos/dcosa.c"
"src/c/elementaryFunctions/cos/dcoss.c"
"src/c/elementaryFunctions/cos/scosa.c"
diff --git a/src/c/matrixOperations/flipdim/dflipdima.c b/src/c/matrixOperations/flipdim/dflipdima.c
new file mode 100644
index 00000000..95eabc9f
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/dflipdima.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 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..281b39eb
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/i16flipdima.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 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..fc302cb7
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/i8flipdima.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 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..588a72ba
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/sflipdima.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 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..fc1941e9
--- /dev/null
+++ b/src/c/matrixOperations/flipdim/u16flipdima.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 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..61b81777
--- /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/flipdim.h b/src/c/matrixOperations/includes/flipdim.h
new file mode 100644
index 00000000..c6dd91d5
--- /dev/null
+++ b/src/c/matrixOperations/includes/flipdim.h
@@ -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
+
+
+#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..f635d5e0
--- /dev/null
+++ b/src/c/matrixOperations/includes/kron.h
@@ -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
+
+
+#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/interfaces/int_flipdim.h b/src/c/matrixOperations/interfaces/int_flipdim.h
new file mode 100644
index 00000000..d3996563
--- /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_kron.h b/src/c/matrixOperations/interfaces/int_kron.h
new file mode 100644
index 00000000..93d25756
--- /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/kron/dkrona.c b/src/c/matrixOperations/kron/dkrona.c
new file mode 100644
index 00000000..9379f96c
--- /dev/null
+++ b/src/c/matrixOperations/kron/dkrona.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 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, col = col1*col2;
+ 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..368d04b5
--- /dev/null
+++ b/src/c/matrixOperations/kron/skrona.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 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, col = col1*col2;
+ 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/triu/.fuse_hidden0000338200000001 b/src/c/matrixOperations/triu/.fuse_hidden0000338200000001
deleted file mode 100644
index 887b5b66..00000000
--- a/src/c/matrixOperations/triu/.fuse_hidden0000338200000001
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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
-
-void dtriu (double *in, int row, int column, 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(row_counter < col_counter)
- {
- out[col_counter*row+col_counter] = in[col_counter*row+col_counter];
- }
- else
- {
- out[col_counter*row+col_counter] = 0;
- }
- }
- }
-} \ No newline at end of file