diff options
author | Abhinav Dronamraju | 2017-09-29 22:00:40 +0530 |
---|---|---|
committer | Abhinav Dronamraju | 2017-09-29 22:00:40 +0530 |
commit | 9bc7ad78e8d7d7acc4b9387aa592542832e80b31 (patch) | |
tree | 7fce060665a91de5e5adb12d02003351c3d1fdfc /src/c/statisticsFunctions/sum | |
parent | 33755eb085a3ca8154cf83773b23fbb8aac4ba3e (diff) | |
parent | ac0045f12ad3d0938758e9742f4107a334e1afaa (diff) | |
download | scilab2c-9bc7ad78e8d7d7acc4b9387aa592542832e80b31.tar.gz scilab2c-9bc7ad78e8d7d7acc4b9387aa592542832e80b31.tar.bz2 scilab2c-9bc7ad78e8d7d7acc4b9387aa592542832e80b31.zip |
NEW FEATURES AND NEW FUNCTIONS
Diffstat (limited to 'src/c/statisticsFunctions/sum')
-rw-r--r-- | src/c/statisticsFunctions/sum/i16columnsuma.c | 34 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/i16rowsuma.c | 35 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/i16suma.c | 26 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/i8columnsuma.c | 34 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/i8rowsuma.c | 35 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/i8suma.c | 27 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/u16columnsuma.c | 35 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/u16rowsuma.c | 34 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/u16suma.c | 25 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/u8columnsuma.c | 34 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/u8rowsuma.c | 35 | ||||
-rw-r--r-- | src/c/statisticsFunctions/sum/u8suma.c | 26 |
12 files changed, 380 insertions, 0 deletions
diff --git a/src/c/statisticsFunctions/sum/i16columnsuma.c b/src/c/statisticsFunctions/sum/i16columnsuma.c new file mode 100644 index 00000000..a34cea13 --- /dev/null +++ b/src/c/statisticsFunctions/sum/i16columnsuma.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void i16columnsuma(int16 *in, int lines, int columns, int16 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < lines; ++i) + { + out[i] = (int16)in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = (int16)i16adds(out[i % lines] , in[i]); + } +} diff --git a/src/c/statisticsFunctions/sum/i16rowsuma.c b/src/c/statisticsFunctions/sum/i16rowsuma.c new file mode 100644 index 00000000..03d8ff29 --- /dev/null +++ b/src/c/statisticsFunctions/sum/i16rowsuma.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void i16rowsuma(int16 *in, int lines, int columns, int16 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < columns; ++i) + { + out[i] = (int16)in[i * lines]; + } + /* + ** Then accumulate in each column. + */ + for (i = 1 ; i <= (lines - 1) * columns ; ++i) + { + out[(i - 1) % columns] = (int16)i16adds( out[(i - 1) % columns] , + in[((i - 1) % columns) * lines + 1 + (i - 1) / columns]); + } +} diff --git a/src/c/statisticsFunctions/sum/i16suma.c b/src/c/statisticsFunctions/sum/i16suma.c new file mode 100644 index 00000000..f5d08093 --- /dev/null +++ b/src/c/statisticsFunctions/sum/i16suma.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +int16 i16suma(int16 *in, int size) { + //floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int i = 0; + int16 accumulate = 0; + + for (i = 0; i < size; ++i) + { + accumulate = i16adds(accumulate, in[i]); + } + return accumulate; +} diff --git a/src/c/statisticsFunctions/sum/i8columnsuma.c b/src/c/statisticsFunctions/sum/i8columnsuma.c new file mode 100644 index 00000000..bb79897c --- /dev/null +++ b/src/c/statisticsFunctions/sum/i8columnsuma.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void i8columnsuma(int8 *in, int lines, int columns, int8 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < lines; ++i) + { + out[i] = (int8)in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = (int8)i8adds(out[i % lines] , in[i]); + } +} diff --git a/src/c/statisticsFunctions/sum/i8rowsuma.c b/src/c/statisticsFunctions/sum/i8rowsuma.c new file mode 100644 index 00000000..2008f32d --- /dev/null +++ b/src/c/statisticsFunctions/sum/i8rowsuma.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void i8rowsuma(int8 *in, int lines, int columns, int8 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < columns; ++i) + { + out[i] = (int8)in[i * lines]; + } + /* + ** Then accumulate in each column. + */ + for (i = 1 ; i <= (lines - 1) * columns ; ++i) + { + out[(i - 1) % columns] = (int8)i8adds( out[(i - 1) % columns] , + in[((i - 1) % columns) * lines + 1 + (i - 1) / columns]); + } +} diff --git a/src/c/statisticsFunctions/sum/i8suma.c b/src/c/statisticsFunctions/sum/i8suma.c new file mode 100644 index 00000000..468a98b9 --- /dev/null +++ b/src/c/statisticsFunctions/sum/i8suma.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +int8 i8suma(int8 *in, int size) { + //floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int8 accumulate = 0; + + int i = 0; + + for (i = 0; i < size; ++i) + { + accumulate = i8adds(accumulate, in[i]); + } + return accumulate; +} diff --git a/src/c/statisticsFunctions/sum/u16columnsuma.c b/src/c/statisticsFunctions/sum/u16columnsuma.c new file mode 100644 index 00000000..82b07757 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u16columnsuma.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#include "sum.h" + +void u16columnsuma(uint16 *in, int lines, int columns, uint16 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < lines; ++i) + { + out[i] = (uint16)in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = (uint16)u16adds(out[i % lines] , in[i]); + } +} diff --git a/src/c/statisticsFunctions/sum/u16rowsuma.c b/src/c/statisticsFunctions/sum/u16rowsuma.c new file mode 100644 index 00000000..535e302f --- /dev/null +++ b/src/c/statisticsFunctions/sum/u16rowsuma.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sum.h" + +void u16rowsuma(uint16 *in, int lines, int columns, uint16 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < columns; ++i) + { + out[i] = (uint16)in[i * lines]; + } + /* + ** Then accumulate in each column. + */ + for (i = 1 ; i <= (lines - 1) * columns ; ++i) + { + out[(i - 1) % columns] = (uint16)u16adds( out[(i - 1) % columns] , + in[((i - 1) % columns) * lines + 1 + (i - 1) / columns]); + } +} diff --git a/src/c/statisticsFunctions/sum/u16suma.c b/src/c/statisticsFunctions/sum/u16suma.c new file mode 100644 index 00000000..5e5620c1 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u16suma.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sum.h" + +uint16 u16suma(uint16 *in, int size) { + //floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int i = 0; + uint16 accumulate = 0; + + for (i = 0; i < size; ++i) + { + accumulate = u16adds(accumulate, in[i]); + } + return accumulate; +} diff --git a/src/c/statisticsFunctions/sum/u8columnsuma.c b/src/c/statisticsFunctions/sum/u8columnsuma.c new file mode 100644 index 00000000..f3e30411 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u8columnsuma.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void u8columnsuma(uint8 *in, int lines, int columns, uint8 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < lines; ++i) + { + out[i] = (uint8)in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = (uint8)u8adds(out[i % lines] , in[i]); + } +} diff --git a/src/c/statisticsFunctions/sum/u8rowsuma.c b/src/c/statisticsFunctions/sum/u8rowsuma.c new file mode 100644 index 00000000..53a49442 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u8rowsuma.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void u8rowsuma(uint8 *in, int lines, int columns, uint8 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < columns; ++i) + { + out[i] = (uint8)in[i * lines]; + } + /* + ** Then accumulate in each column. + */ + for (i = 1 ; i <= (lines - 1) * columns ; ++i) + { + out[(i - 1) % columns] = (uint8)u8adds( out[(i - 1) % columns] , + in[((i - 1) % columns) * lines + 1 + (i - 1) / columns]); + } +} diff --git a/src/c/statisticsFunctions/sum/u8suma.c b/src/c/statisticsFunctions/sum/u8suma.c new file mode 100644 index 00000000..e5febef1 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u8suma.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +uint8 u8suma(uint8 *in, int size) { + //floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int i = 0; + uint8 accumulate = 0; + + for (i = 0; i < size; ++i) + { + accumulate = u8adds(accumulate, in[i]); + } + return accumulate; +} |