diff options
author | siddhu8990 | 2016-05-18 09:44:43 +0530 |
---|---|---|
committer | siddhu8990 | 2016-05-18 09:44:43 +0530 |
commit | 18587a5f0cf86d636ac23a5be567437cd822bbc2 (patch) | |
tree | 1ab9bb60cfc13922e731531b30f6e07e0a903378 /2.3-1/src | |
parent | 7d13dc4707f5c4387acdb1946b955490629d2f98 (diff) | |
download | Scilab2C-18587a5f0cf86d636ac23a5be567437cd822bbc2.tar.gz Scilab2C-18587a5f0cf86d636ac23a5be567437cd822bbc2.tar.bz2 Scilab2C-18587a5f0cf86d636ac23a5be567437cd822bbc2.zip |
Support added for kron, flipdim
Diffstat (limited to '2.3-1/src')
-rw-r--r-- | 2.3-1/src/c/matrixOperations/flipdim/dflipdima.c | 80 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/flipdim/i16flipdima.c | 80 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/flipdim/i8flipdima.c | 80 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/flipdim/sflipdima.c | 80 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/flipdim/u16flipdima.c | 80 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/flipdim/u8flipdima.c | 80 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/includes/flipdim.h | 39 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/includes/kron.h | 31 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/interfaces/int_flipdim.h | 109 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/interfaces/int_kron.h | 43 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/kron/dkrona.c | 38 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/kron/skrona.c | 38 | ||||
-rw-r--r-- | 2.3-1/src/c/matrixOperations/triu/.fuse_hidden0000338200000001 | 32 |
13 files changed, 778 insertions, 32 deletions
diff --git a/2.3-1/src/c/matrixOperations/flipdim/dflipdima.c b/2.3-1/src/c/matrixOperations/flipdim/dflipdima.c new file mode 100644 index 00000000..95eabc9f --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/flipdim/i16flipdima.c b/2.3-1/src/c/matrixOperations/flipdim/i16flipdima.c new file mode 100644 index 00000000..281b39eb --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/flipdim/i8flipdima.c b/2.3-1/src/c/matrixOperations/flipdim/i8flipdima.c new file mode 100644 index 00000000..fc302cb7 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/flipdim/sflipdima.c b/2.3-1/src/c/matrixOperations/flipdim/sflipdima.c new file mode 100644 index 00000000..588a72ba --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/flipdim/u16flipdima.c b/2.3-1/src/c/matrixOperations/flipdim/u16flipdima.c new file mode 100644 index 00000000..fc1941e9 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/flipdim/u8flipdima.c b/2.3-1/src/c/matrixOperations/flipdim/u8flipdima.c new file mode 100644 index 00000000..61b81777 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/includes/flipdim.h b/2.3-1/src/c/matrixOperations/includes/flipdim.h new file mode 100644 index 00000000..c6dd91d5 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/includes/kron.h b/2.3-1/src/c/matrixOperations/includes/kron.h new file mode 100644 index 00000000..f635d5e0 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/interfaces/int_flipdim.h b/2.3-1/src/c/matrixOperations/interfaces/int_flipdim.h new file mode 100644 index 00000000..d3996563 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/interfaces/int_kron.h b/2.3-1/src/c/matrixOperations/interfaces/int_kron.h new file mode 100644 index 00000000..93d25756 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/kron/dkrona.c b/2.3-1/src/c/matrixOperations/kron/dkrona.c new file mode 100644 index 00000000..9379f96c --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/kron/skrona.c b/2.3-1/src/c/matrixOperations/kron/skrona.c new file mode 100644 index 00000000..368d04b5 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/triu/.fuse_hidden0000338200000001 b/2.3-1/src/c/matrixOperations/triu/.fuse_hidden0000338200000001 deleted file mode 100644 index 887b5b66..00000000 --- a/2.3-1/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 |