diff options
author | imushir | 2015-11-27 15:22:41 +0530 |
---|---|---|
committer | imushir | 2015-11-27 15:22:41 +0530 |
commit | 73fea946691734a4b2eba5a3dc75c172dfa21094 (patch) | |
tree | 7e9f9ede3a0013eeb3b9ee32bd3997040b7f660c | |
parent | 6e06b6a195c1d628f505fb0641bf5f4fae7b7aba (diff) | |
download | Scilab2C-73fea946691734a4b2eba5a3dc75c172dfa21094.tar.gz Scilab2C-73fea946691734a4b2eba5a3dc75c172dfa21094.tar.bz2 Scilab2C-73fea946691734a4b2eba5a3dc75c172dfa21094.zip |
added c files for u8 u16 i8 i16
40 files changed, 983 insertions, 12 deletions
diff --git a/2.3-1/src/c/statisticsFunctions/max/dcolumnmaxa.c b/2.3-1/src/c/statisticsFunctions/max/dcolumnmaxa.c index ae0bbd47..e66422a2 100644 --- a/2.3-1/src/c/statisticsFunctions/max/dcolumnmaxa.c +++ b/2.3-1/src/c/statisticsFunctions/max/dcolumnmaxa.c @@ -11,14 +11,16 @@ */ #include "statMax.h" +//#include "max.h" 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/2.3-1/src/c/statisticsFunctions/max/dcolumnmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/dcolumnmaxa.c~ new file mode 100644 index 00000000..e66422a2 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/dcolumnmaxa.c~ @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.h" + +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*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]>out[i]) + out[i] = in[i+j*rows]; + } + +} diff --git a/2.3-1/src/c/statisticsFunctions/max/dmaxa.c b/2.3-1/src/c/statisticsFunctions/max/dmaxa.c index 5e2145e3..63644635 100644 --- a/2.3-1/src/c/statisticsFunctions/max/dmaxa.c +++ b/2.3-1/src/c/statisticsFunctions/max/dmaxa.c @@ -11,14 +11,15 @@ */ #include "statMax.h" - +//#include "max.h" double dmaxa(double *in, int size) { double out = in[0]; int i = 0; 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/2.3-1/src/c/statisticsFunctions/max/dmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/dmaxa.c~ new file mode 100644 index 00000000..931c0d2d --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/dmaxa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.h" +double dmaxa(double *in, int size) { + double out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) out = in[i]; + } + return out; + +} diff --git a/2.3-1/src/c/statisticsFunctions/max/drowmaxa.c b/2.3-1/src/c/statisticsFunctions/max/drowmaxa.c index a3099231..db0c72c0 100644 --- a/2.3-1/src/c/statisticsFunctions/max/drowmaxa.c +++ b/2.3-1/src/c/statisticsFunctions/max/drowmaxa.c @@ -11,13 +11,14 @@ */ #include "statMax.h" - +//#include "max.h" 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/2.3-1/src/c/statisticsFunctions/max/drowmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/drowmaxa.c~ new file mode 100644 index 00000000..db0c72c0 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/drowmaxa.c~ @@ -0,0 +1,24 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.h" +void drowmaxa(double *in, int rows, int columns, double* out) { + int i = 0, j = 0; + 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]; + } +} diff --git a/2.3-1/src/c/statisticsFunctions/max/i16columnmaxa.c b/2.3-1/src/c/statisticsFunctions/max/i16columnmaxa.c new file mode 100644 index 00000000..94c5cf6a --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i16columnmaxa.c @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i16columnmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/i16columnmaxa.c~ new file mode 100644 index 00000000..94c5cf6a --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i16columnmaxa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i16maxa.c b/2.3-1/src/c/statisticsFunctions/max/i16maxa.c new file mode 100644 index 00000000..c1294193 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i16maxa.c @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i16maxa.c~ b/2.3-1/src/c/statisticsFunctions/max/i16maxa.c~ new file mode 100644 index 00000000..c1294193 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i16maxa.c~ @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i16rowmaxa.c b/2.3-1/src/c/statisticsFunctions/max/i16rowmaxa.c new file mode 100644 index 00000000..263e56ca --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i16rowmaxa.c @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i16rowmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/i16rowmaxa.c~ new file mode 100644 index 00000000..263e56ca --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i16rowmaxa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i8columnmaxa.c b/2.3-1/src/c/statisticsFunctions/max/i8columnmaxa.c new file mode 100644 index 00000000..9c214dbb --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i8columnmaxa.c @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i8columnmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/i8columnmaxa.c~ new file mode 100644 index 00000000..9c214dbb --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i8columnmaxa.c~ @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i8maxa.c b/2.3-1/src/c/statisticsFunctions/max/i8maxa.c new file mode 100644 index 00000000..67fd3358 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i8maxa.c @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i8maxa.c~ b/2.3-1/src/c/statisticsFunctions/max/i8maxa.c~ new file mode 100644 index 00000000..67fd3358 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i8maxa.c~ @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i8rowmaxa.c b/2.3-1/src/c/statisticsFunctions/max/i8rowmaxa.c new file mode 100644 index 00000000..a6d15aa3 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i8rowmaxa.c @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/i8rowmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/i8rowmaxa.c~ new file mode 100644 index 00000000..a6d15aa3 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/i8rowmaxa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/scolumnmaxa.c b/2.3-1/src/c/statisticsFunctions/max/scolumnmaxa.c index 71af8460..4014f88a 100644 --- a/2.3-1/src/c/statisticsFunctions/max/scolumnmaxa.c +++ b/2.3-1/src/c/statisticsFunctions/max/scolumnmaxa.c @@ -11,12 +11,13 @@ */ #include "statMax.h" +//#include "max.h" 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/2.3-1/src/c/statisticsFunctions/max/scolumnmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/scolumnmaxa.c~ new file mode 100644 index 00000000..4014f88a --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/scolumnmaxa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.h" + +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*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]>out[i]) out[i] = in[i+j*rows]; + } + +} diff --git a/2.3-1/src/c/statisticsFunctions/max/smaxa.c b/2.3-1/src/c/statisticsFunctions/max/smaxa.c index f47fcffe..03b4cf18 100644 --- a/2.3-1/src/c/statisticsFunctions/max/smaxa.c +++ b/2.3-1/src/c/statisticsFunctions/max/smaxa.c @@ -9,8 +9,8 @@ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt * */ - #include "statMax.h" +//#include "max.h" float smaxa(float *in, int size) { float out = in[0]; diff --git a/2.3-1/src/c/statisticsFunctions/max/smaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/smaxa.c~ new file mode 100644 index 00000000..03b4cf18 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/smaxa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.h" + +float smaxa(float *in, int size) { + float out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) out = in[i]; + } + return out; + +} diff --git a/2.3-1/src/c/statisticsFunctions/max/srowmaxa.c b/2.3-1/src/c/statisticsFunctions/max/srowmaxa.c index c87ccf7f..ea6c33d6 100644 --- a/2.3-1/src/c/statisticsFunctions/max/srowmaxa.c +++ b/2.3-1/src/c/statisticsFunctions/max/srowmaxa.c @@ -9,8 +9,8 @@ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt * */ - #include "statMax.h" +//#include "max.h" void srowmaxa(float *in, int rows, int columns, float* out) { int i = 0, j = 0; diff --git a/2.3-1/src/c/statisticsFunctions/max/srowmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/srowmaxa.c~ new file mode 100644 index 00000000..ea6c33d6 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/srowmaxa.c~ @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.h" + +void srowmaxa(float *in, int rows, int columns, float* out) { + int i = 0, j = 0; + + 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]; + } +} diff --git a/2.3-1/src/c/statisticsFunctions/max/testDoubleMax.c b/2.3-1/src/c/statisticsFunctions/max/testDoubleMax.c index 81c50324..883b427f 100644 --- a/2.3-1/src/c/statisticsFunctions/max/testDoubleMax.c +++ b/2.3-1/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/2.3-1/src/c/statisticsFunctions/max/testDoubleMax.c~ b/2.3-1/src/c/statisticsFunctions/max/testDoubleMax.c~ new file mode 100644 index 00000000..883b427f --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/testDoubleMax.c~ @@ -0,0 +1,93 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + +#include "statMax.h" +//#include "max.h" +#include "assert.h" +#include "stdio.h" + + +static void dmaxaTest(void){ + double in[12]={4,5,7,1,2,6,4,1,2,5,4,3}; + double out; + + out = dmaxa(in,12); + assert(out-7==0); + +} + + +static void drowmaxaTest(void){ + double in[12]={4,5,7,1,2,6,4,1,2,5,4,3}; + double result2[2]={7,5}; + double result3[3]={7,6,5}; + double result4[4]={7,6,4,5}; + double result6[6]={5,7,6,4,5,4}; + double out1[1],out2[2],out3[3],out4[4],out6[6],out12[12]; + int i; + + + drowmaxa(in,12,1,out1); + drowmaxa(in,6,2,out2); + drowmaxa(in,4,3,out3); + drowmaxa(in,3,4,out4); + drowmaxa(in,2,6,out6); + drowmaxa(in,1,12,out12); + + assert(out1[0]-7==0); + for (i=0;i<2;i++) assert(out2[i]-result2[i]==0); + for (i=0;i<3;i++) assert(out3[i]-result3[i]==0); + for (i=0;i<4;i++) assert(out4[i]-result4[i]==0); + for (i=0;i<6;i++) assert(out6[i]-result6[i]==0); + for (i=0;i<12;i++) assert(out12[i]-in[i]==0); +} + + +static void dcolumnmaxaTest(void){ + double in[12]={4,5,7,1,2,6,4,1,2,5,4,3}; + double out1[1],out2[2],out3[3],out4[4],out6[6],out12[12]; + double result2[2]={7,6}; + double result3[3]={5,5,7}; + double result4[4]={4,6,7,3}; + double result6[6]={4,5,7,5,4,6}; + int i; + + + + dcolumnmaxa(in,12,1,out12); + dcolumnmaxa(in,6,2,out6); + dcolumnmaxa(in,4,3,out4); + dcolumnmaxa(in,3,4,out3); + dcolumnmaxa(in,2,6,out2); + dcolumnmaxa(in,1,12,out1); + + assert(out1[0]-7==0); + for (i=0;i<2;i++) assert(out2[i]-result2[i]==0); + for (i=0;i<3;i++) assert(out3[i]-result3[i]==0); + for (i=0;i<4;i++) assert(out4[i]-result4[i]==0); + for (i=0;i<6;i++) assert(out6[i]-result6[i]==0); + for (i=0;i<12;i++) assert(out12[i]-in[i]==0); +} + +static int maxTest(void){ + dmaxaTest(); + drowmaxaTest(); + dcolumnmaxaTest(); + return 0; +} + + +int main(void){ + assert(maxTest()==0); + return 0; +} diff --git a/2.3-1/src/c/statisticsFunctions/max/testFloatMax.c b/2.3-1/src/c/statisticsFunctions/max/testFloatMax.c index 7741aef4..cb572f7e 100644 --- a/2.3-1/src/c/statisticsFunctions/max/testFloatMax.c +++ b/2.3-1/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/2.3-1/src/c/statisticsFunctions/max/testFloatMax.c~ b/2.3-1/src/c/statisticsFunctions/max/testFloatMax.c~ new file mode 100644 index 00000000..cb572f7e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/testFloatMax.c~ @@ -0,0 +1,93 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 + * + */ + + + +#include "statMax.h" +//#include "max.h" +#include "assert.h" +#include "stdio.h" + +static void smaxaTest(void){ + float in[12]={4,5,7,1,2,6,4,1,2,5,4,3}; + float out; + + out = smaxa(in,12); + assert(out-7==0); + +} + + +static void srowmaxaTest(void){ + float in[12]={4,5,7,1,2,6,4,1,2,5,4,3}; + float out1[1],out2[2],out3[3],out4[4],out6[6],out12[12]; + float result2[2]={7,5}; + float result3[3]={7,6,5}; + float result4[4]={7,6,4,5}; + float result6[6]={5,7,6,4,5,4}; + int i; + + + srowmaxa(in,12,1,out1); + srowmaxa(in,6,2,out2); + srowmaxa(in,4,3,out3); + srowmaxa(in,3,4,out4); + srowmaxa(in,2,6,out6); + srowmaxa(in,1,12,out12); + + assert(out1[0]-7==0); + for (i=0;i<2;i++) assert(out2[i]-result2[i]==0); + for (i=0;i<3;i++) assert(out3[i]-result3[i]==0); + for (i=0;i<4;i++) assert(out4[i]-result4[i]==0); + for (i=0;i<6;i++) assert(out6[i]-result6[i]==0); + for (i=0;i<12;i++) assert(out12[i]-in[i]==0); +} + + +static void scolumnmaxaTest(void){ + float in[12]={4,5,7,1,2,6,4,1,2,5,4,3}; + float out1[1],out2[2],out3[3],out4[4],out6[6],out12[12]; + float result2[2]={7,6}; + float result3[3]={5,5,7}; + float result4[4]={4,6,7,3}; + float result6[6]={4,5,7,5,4,6}; + int i; + + + + scolumnmaxa(in,12,1,out12); + scolumnmaxa(in,6,2,out6); + scolumnmaxa(in,4,3,out4); + scolumnmaxa(in,3,4,out3); + scolumnmaxa(in,2,6,out2); + scolumnmaxa(in,1,12,out1); + + assert(out1[0]-7==0); + for (i=0;i<2;i++) assert(out2[i]-result2[i]==0); + for (i=0;i<3;i++) assert(out3[i]-result3[i]==0); + for (i=0;i<4;i++) assert(out4[i]-result4[i]==0); + for (i=0;i<6;i++) assert(out6[i]-result6[i]==0); + for (i=0;i<12;i++) assert(out12[i]-in[i]==0); +} + +static int maxTest(void){ + smaxaTest(); + srowmaxaTest(); + scolumnmaxaTest(); + return 0; +} + + +int main(void){ + assert(maxTest()==0); + return 0; +} diff --git a/2.3-1/src/c/statisticsFunctions/max/u16columnmaxa.c b/2.3-1/src/c/statisticsFunctions/max/u16columnmaxa.c new file mode 100644 index 00000000..e0ccb3ae --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u16columnmaxa.c @@ -0,0 +1,28 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" + +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/u16columnmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/u16columnmaxa.c~ new file mode 100644 index 00000000..e0ccb3ae --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u16columnmaxa.c~ @@ -0,0 +1,28 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" + +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/u16maxa.c b/2.3-1/src/c/statisticsFunctions/max/u16maxa.c new file mode 100644 index 00000000..c3af84f6 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u16maxa.c @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/u16maxa.c~ b/2.3-1/src/c/statisticsFunctions/max/u16maxa.c~ new file mode 100644 index 00000000..c881d88a --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u16maxa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/u16rowmaxa.c b/2.3-1/src/c/statisticsFunctions/max/u16rowmaxa.c new file mode 100644 index 00000000..cef61f1d --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u16rowmaxa.c @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include <stdlib.h> +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/u16rowmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/u16rowmaxa.c~ new file mode 100644 index 00000000..7c6b6801 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u16rowmaxa.c~ @@ -0,0 +1,28 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +#include <stdlib.h> +//#include "max.h" + +void u16rowmaxa(uint16 *in, int rows, int columns, uint16* out) { + int i = 0, j = 0; + 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/2.3-1/src/c/statisticsFunctions/max/u8columnmaxa.c b/2.3-1/src/c/statisticsFunctions/max/u8columnmaxa.c new file mode 100644 index 00000000..222bc291 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u8columnmaxa.c @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/u8columnmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/u8columnmaxa.c~ new file mode 100644 index 00000000..e7f8f0ef --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u8columnmaxa.c~ @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.h" + +void u8columnmaxa(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]; + } + +} diff --git a/2.3-1/src/c/statisticsFunctions/max/u8maxa.c b/2.3-1/src/c/statisticsFunctions/max/u8maxa.c new file mode 100644 index 00000000..3e599150 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u8maxa.c @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/u8maxa.c~ b/2.3-1/src/c/statisticsFunctions/max/u8maxa.c~ new file mode 100644 index 00000000..d9b6eca0 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u8maxa.c~ @@ -0,0 +1,27 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "statMax.h" +//#include "max.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/2.3-1/src/c/statisticsFunctions/max/u8rowmaxa.c b/2.3-1/src/c/statisticsFunctions/max/u8rowmaxa.c new file mode 100644 index 00000000..fda293c7 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u8rowmaxa.c @@ -0,0 +1,28 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.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]; + } + } +} diff --git a/2.3-1/src/c/statisticsFunctions/max/u8rowmaxa.c~ b/2.3-1/src/c/statisticsFunctions/max/u8rowmaxa.c~ new file mode 100644 index 00000000..fda293c7 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/max/u8rowmaxa.c~ @@ -0,0 +1,28 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ +#include "statMax.h" +//#include "max.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]; + } + } +} |