diff options
Diffstat (limited to 'src/c/matrixOperations/cumprod')
18 files changed, 648 insertions, 0 deletions
diff --git a/src/c/matrixOperations/cumprod/dcolumncumproda.c b/src/c/matrixOperations/cumprod/dcolumncumproda.c new file mode 100644 index 0000000..b64fac4 --- /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 0000000..199880c --- /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 0000000..21082d0 --- /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 0000000..e5af54b --- /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 0000000..8bee315 --- /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 0000000..0c38b5e --- /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 0000000..cf2156d --- /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 0000000..f0a5404 --- /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 0000000..c2ecf19 --- /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 0000000..e97ca90 --- /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 0000000..fb55a31 --- /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 0000000..cab4e44 --- /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 0000000..7b3c2d8 --- /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 0000000..5740e86 --- /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 0000000..23b452c --- /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 0000000..3a6ee92 --- /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 0000000..8970f19 --- /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 0000000..61b214c --- /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 |