diff options
Diffstat (limited to '2.3-1/src/c/matrixOperations/cumsum')
18 files changed, 648 insertions, 0 deletions
diff --git a/2.3-1/src/c/matrixOperations/cumsum/dcolumncumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/dcolumncumsuma.c new file mode 100644 index 00000000..daf60134 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/dcumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/dcumsuma.c new file mode 100644 index 00000000..11b0a88f --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/drowcumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/drowcumsuma.c new file mode 100644 index 00000000..4bb3f320 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/i16columncumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/i16columncumsuma.c new file mode 100644 index 00000000..ae84428b --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/i16cumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/i16cumsuma.c new file mode 100644 index 00000000..4e2fb591 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/i16rowcumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/i16rowcumsuma.c new file mode 100644 index 00000000..67cb9c7f --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/i8columncumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/i8columncumsuma.c new file mode 100644 index 00000000..67f72bcc --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/i8cumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/i8cumsuma.c new file mode 100644 index 00000000..8aa92871 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/i8rowcumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/i8rowcumsuma.c new file mode 100644 index 00000000..a9e7da81 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/scolumncumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/scolumncumsuma.c new file mode 100644 index 00000000..a7e8a851 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/scumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/scumsuma.c new file mode 100644 index 00000000..122e165d --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/srowcumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/srowcumsuma.c new file mode 100644 index 00000000..3af5d367 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/u16columncumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/u16columncumsuma.c new file mode 100644 index 00000000..aa16a582 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/u16cumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/u16cumsuma.c new file mode 100644 index 00000000..d403571a --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/u16rowcumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/u16rowcumsuma.c new file mode 100644 index 00000000..0ef0945c --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/u8columncumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/u8columncumsuma.c new file mode 100644 index 00000000..890a0bee --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/u8cumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/u8cumsuma.c new file mode 100644 index 00000000..4f2acfe6 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/matrixOperations/cumsum/u8rowcumsuma.c b/2.3-1/src/c/matrixOperations/cumsum/u8rowcumsuma.c new file mode 100644 index 00000000..1204d83e --- /dev/null +++ b/2.3-1/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 |