diff options
Diffstat (limited to 'src/c/statisticsFunctions/max')
20 files changed, 321 insertions, 10 deletions
diff --git a/src/c/statisticsFunctions/max/dcolumnmaxa.c b/src/c/statisticsFunctions/max/dcolumnmaxa.c index ae0bbd47..ec717778 100644 --- a/src/c/statisticsFunctions/max/dcolumnmaxa.c +++ b/src/c/statisticsFunctions/max/dcolumnmaxa.c @@ -16,9 +16,10 @@ void dcolumnmaxa(double *in, int rows, int columns, double* out) { int i = 0, j = 0; for (i = 0; i < rows; i++) { - out[i]=in[i]; + out[i]=in[i*columns]; for (j=0;j<columns;j++) - if (in[i+j*rows]>out[i]) out[i] = in[i+j*rows]; + if (in[i+j*rows]>out[i]) + out[i] = in[i+j*rows]; } } diff --git a/src/c/statisticsFunctions/max/dmaxa.c b/src/c/statisticsFunctions/max/dmaxa.c index 5e2145e3..7292f3cd 100644 --- a/src/c/statisticsFunctions/max/dmaxa.c +++ b/src/c/statisticsFunctions/max/dmaxa.c @@ -18,7 +18,8 @@ double dmaxa(double *in, int size) { for (i = 1; i < size; ++i) { - if (in[i]>out) out = in[i]; + if (in[i]>out) + out = in[i]; } return out; diff --git a/src/c/statisticsFunctions/max/drowmaxa.c b/src/c/statisticsFunctions/max/drowmaxa.c index a3099231..596c535f 100644 --- a/src/c/statisticsFunctions/max/drowmaxa.c +++ b/src/c/statisticsFunctions/max/drowmaxa.c @@ -14,10 +14,11 @@ void drowmaxa(double *in, int rows, int columns, double* out) { int i = 0, j = 0; - - for (i = 0; i < columns; i++) { + for (i = 0; i < columns; i++) + { out[i]=in[i*rows]; for (j = 1 ; j < rows ; j++) - if (in[i*rows+j]>out[i]) out[i] = in[i*rows+j]; + if (in[i*rows+j]>out[i]) + out[i] = in[i*rows+j]; } } diff --git a/src/c/statisticsFunctions/max/i16columnmaxa.c b/src/c/statisticsFunctions/max/i16columnmaxa.c new file mode 100644 index 00000000..87cc579c --- /dev/null +++ b/src/c/statisticsFunctions/max/i16columnmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void i16columnmaxa(int16 *in, int rows, int columns, int16* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) { + out[i]=(int16)in[i*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]>out[i]) + out[i] = (int16)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/max/i16maxa.c b/src/c/statisticsFunctions/max/i16maxa.c new file mode 100644 index 00000000..b2eab344 --- /dev/null +++ b/src/c/statisticsFunctions/max/i16maxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +int16 i16maxa(int16 *in, int size) { + int16 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) + out = (int16)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/max/i16rowmaxa.c b/src/c/statisticsFunctions/max/i16rowmaxa.c new file mode 100644 index 00000000..46c4ae29 --- /dev/null +++ b/src/c/statisticsFunctions/max/i16rowmaxa.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void i16rowmaxa(int16 *in, int rows, int columns, int16* out) { + int i = 0, j = 0; + + for (i = 0; i < columns; i++) { + out[i]=(int16)in[i*rows]; + for (j = 1 ; j < rows ; j++) + if (in[i*rows+j]>out[i]) + out[i] = (int16)in[i*rows+j]; + } +} diff --git a/src/c/statisticsFunctions/max/i8columnmaxa.c b/src/c/statisticsFunctions/max/i8columnmaxa.c new file mode 100644 index 00000000..6c7ea25c --- /dev/null +++ b/src/c/statisticsFunctions/max/i8columnmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void i8columnmaxa(int8 *in, int rows, int columns, int8* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) { + out[i]=(int8)in[i*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]>out[i]) + out[i] = (int8)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/max/i8maxa.c b/src/c/statisticsFunctions/max/i8maxa.c new file mode 100644 index 00000000..d57b9957 --- /dev/null +++ b/src/c/statisticsFunctions/max/i8maxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + +int8 i8maxa(int8 *in, int size) { + int8 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) + out = (int8)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/max/i8rowmaxa.c b/src/c/statisticsFunctions/max/i8rowmaxa.c new file mode 100644 index 00000000..677c61c7 --- /dev/null +++ b/src/c/statisticsFunctions/max/i8rowmaxa.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void i8rowmaxa(int8 *in, int rows, int columns, int8* out) { + int i = 0, j = 0; + + for (i = 0; i < columns; i++) { + out[i]=(int8)in[i*rows]; + for (j = 1 ; j < rows ; j++) + if (in[i*rows+j]>out[i]) + out[i] = (int8)in[i*rows+j]; + } +} diff --git a/src/c/statisticsFunctions/max/scolumnmaxa.c b/src/c/statisticsFunctions/max/scolumnmaxa.c index 71af8460..185ab985 100644 --- a/src/c/statisticsFunctions/max/scolumnmaxa.c +++ b/src/c/statisticsFunctions/max/scolumnmaxa.c @@ -16,7 +16,7 @@ void scolumnmaxa(float *in, int rows, int columns, float* out) { int i = 0, j = 0; for (i = 0; i < rows; i++) { - out[i]=in[i]; + out[i]=in[i*columns]; for (j=0;j<columns;j++) if (in[i+j*rows]>out[i]) out[i] = in[i+j*rows]; } diff --git a/src/c/statisticsFunctions/max/smaxa.c b/src/c/statisticsFunctions/max/smaxa.c index f47fcffe..3410faea 100644 --- a/src/c/statisticsFunctions/max/smaxa.c +++ b/src/c/statisticsFunctions/max/smaxa.c @@ -9,9 +9,9 @@ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt * */ - #include "statMax.h" + float smaxa(float *in, int size) { float out = in[0]; int i = 0; diff --git a/src/c/statisticsFunctions/max/srowmaxa.c b/src/c/statisticsFunctions/max/srowmaxa.c index c87ccf7f..8f3b30ee 100644 --- a/src/c/statisticsFunctions/max/srowmaxa.c +++ b/src/c/statisticsFunctions/max/srowmaxa.c @@ -9,9 +9,9 @@ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt * */ - #include "statMax.h" + void srowmaxa(float *in, int rows, int columns, float* out) { int i = 0, j = 0; diff --git a/src/c/statisticsFunctions/max/testDoubleMax.c b/src/c/statisticsFunctions/max/testDoubleMax.c index 81c50324..883b427f 100644 --- a/src/c/statisticsFunctions/max/testDoubleMax.c +++ b/src/c/statisticsFunctions/max/testDoubleMax.c @@ -11,8 +11,8 @@ */ - #include "statMax.h" +//#include "max.h" #include "assert.h" #include "stdio.h" diff --git a/src/c/statisticsFunctions/max/testFloatMax.c b/src/c/statisticsFunctions/max/testFloatMax.c index 7741aef4..cb572f7e 100644 --- a/src/c/statisticsFunctions/max/testFloatMax.c +++ b/src/c/statisticsFunctions/max/testFloatMax.c @@ -13,6 +13,7 @@ #include "statMax.h" +//#include "max.h" #include "assert.h" #include "stdio.h" diff --git a/src/c/statisticsFunctions/max/u16columnmaxa.c b/src/c/statisticsFunctions/max/u16columnmaxa.c new file mode 100644 index 00000000..5b4f4236 --- /dev/null +++ b/src/c/statisticsFunctions/max/u16columnmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void u16columnmaxa(uint16 *in, int rows, int columns, uint16* out) { + int i = 0, j = 0; + + + for (i = 0; i < rows; i++) { + out[i]=(uint16)in[i]; + for (j=0;j<columns;j++) + if (in[i+j*rows]>out[i]) + out[i] = (uint16)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/max/u16maxa.c b/src/c/statisticsFunctions/max/u16maxa.c new file mode 100644 index 00000000..7c9078d5 --- /dev/null +++ b/src/c/statisticsFunctions/max/u16maxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + +uint16 u16maxa(uint16 *in, int size) { + uint16 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) + out = (uint16)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/max/u16rowmaxa.c b/src/c/statisticsFunctions/max/u16rowmaxa.c new file mode 100644 index 00000000..eacbe848 --- /dev/null +++ b/src/c/statisticsFunctions/max/u16rowmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + +void u16rowmaxa(uint16 *in, int rows, int columns, uint16* out) { + int i = 0, j = 0; + //out = malloc(columns*sizeof(uint16)); + for (i = 0; i < columns; i++) + { + out[i]=(uint16)in[i]; + for (j = 1 ; j < rows ; j++) + { + if (in[j*columns+i]>out[i]) + out[i] = (uint16)in[j*columns+i]; + } + } + +} diff --git a/src/c/statisticsFunctions/max/u8columnmaxa.c b/src/c/statisticsFunctions/max/u8columnmaxa.c new file mode 100644 index 00000000..ac9bc086 --- /dev/null +++ b/src/c/statisticsFunctions/max/u8columnmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + + +void u8columnmaxa(uint8 *in, int rows, int columns, uint8* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) +{ + out[i]=(uint8)in[0]; + for (j=0;j<columns;j++) + if (in[j]>out[i]) + out[i] = (uint8)in[j]; + } + +} diff --git a/src/c/statisticsFunctions/max/u8maxa.c b/src/c/statisticsFunctions/max/u8maxa.c new file mode 100644 index 00000000..3f84af41 --- /dev/null +++ b/src/c/statisticsFunctions/max/u8maxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +uint8 u8maxa(uint8 *in, int size) { + uint8 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) + out = (uint8)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/max/u8rowmaxa.c b/src/c/statisticsFunctions/max/u8rowmaxa.c new file mode 100644 index 00000000..0ddae26d --- /dev/null +++ b/src/c/statisticsFunctions/max/u8rowmaxa.c @@ -0,0 +1,28 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + + +void u8rowmaxa(uint8 *in, int rows, int columns, uint8* out) { + int i = 0, j = 0; + + + for (i = 0; i < columns; i++) + { + out[i]=(uint8)in[0]; + for (j = 0 ; j < rows ; j++) + { + if (in[j]>out[i]) + out[i] = (uint8)in[j]; + } + } +} |