diff options
author | imushir | 2015-11-27 15:22:41 +0530 |
---|---|---|
committer | imushir | 2015-11-27 15:22:41 +0530 |
commit | 5f2d4d678256289e72c1455cf26d9c0ecdeedc0e (patch) | |
tree | 3b9a44694fc7fa3a7f54592a2def72e3aa14d567 /src/c | |
parent | 909cf3d489c5a35296b84f6e377c3af862987b7f (diff) | |
download | Scilab2C_fossee_old-5f2d4d678256289e72c1455cf26d9c0ecdeedc0e.tar.gz Scilab2C_fossee_old-5f2d4d678256289e72c1455cf26d9c0ecdeedc0e.tar.bz2 Scilab2C_fossee_old-5f2d4d678256289e72c1455cf26d9c0ecdeedc0e.zip |
added c files for u8 u16 i8 i16
Diffstat (limited to 'src/c')
40 files changed, 983 insertions, 12 deletions
diff --git a/src/c/statisticsFunctions/max/dcolumnmaxa.c b/src/c/statisticsFunctions/max/dcolumnmaxa.c index ae0bbd4..e66422a 100644 --- a/src/c/statisticsFunctions/max/dcolumnmaxa.c +++ b/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/src/c/statisticsFunctions/max/dcolumnmaxa.c~ b/src/c/statisticsFunctions/max/dcolumnmaxa.c~ new file mode 100644 index 0000000..e66422a --- /dev/null +++ b/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/src/c/statisticsFunctions/max/dmaxa.c b/src/c/statisticsFunctions/max/dmaxa.c index 5e2145e..6364463 100644 --- a/src/c/statisticsFunctions/max/dmaxa.c +++ b/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/src/c/statisticsFunctions/max/dmaxa.c~ b/src/c/statisticsFunctions/max/dmaxa.c~ new file mode 100644 index 0000000..931c0d2 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/drowmaxa.c b/src/c/statisticsFunctions/max/drowmaxa.c index a309923..db0c72c 100644 --- a/src/c/statisticsFunctions/max/drowmaxa.c +++ b/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/src/c/statisticsFunctions/max/drowmaxa.c~ b/src/c/statisticsFunctions/max/drowmaxa.c~ new file mode 100644 index 0000000..db0c72c --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i16columnmaxa.c b/src/c/statisticsFunctions/max/i16columnmaxa.c new file mode 100644 index 0000000..94c5cf6 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i16columnmaxa.c~ b/src/c/statisticsFunctions/max/i16columnmaxa.c~ new file mode 100644 index 0000000..94c5cf6 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i16maxa.c b/src/c/statisticsFunctions/max/i16maxa.c new file mode 100644 index 0000000..c129419 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i16maxa.c~ b/src/c/statisticsFunctions/max/i16maxa.c~ new file mode 100644 index 0000000..c129419 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i16rowmaxa.c b/src/c/statisticsFunctions/max/i16rowmaxa.c new file mode 100644 index 0000000..263e56c --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i16rowmaxa.c~ b/src/c/statisticsFunctions/max/i16rowmaxa.c~ new file mode 100644 index 0000000..263e56c --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i8columnmaxa.c b/src/c/statisticsFunctions/max/i8columnmaxa.c new file mode 100644 index 0000000..9c214db --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i8columnmaxa.c~ b/src/c/statisticsFunctions/max/i8columnmaxa.c~ new file mode 100644 index 0000000..9c214db --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i8maxa.c b/src/c/statisticsFunctions/max/i8maxa.c new file mode 100644 index 0000000..67fd335 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i8maxa.c~ b/src/c/statisticsFunctions/max/i8maxa.c~ new file mode 100644 index 0000000..67fd335 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i8rowmaxa.c b/src/c/statisticsFunctions/max/i8rowmaxa.c new file mode 100644 index 0000000..a6d15aa --- /dev/null +++ b/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/src/c/statisticsFunctions/max/i8rowmaxa.c~ b/src/c/statisticsFunctions/max/i8rowmaxa.c~ new file mode 100644 index 0000000..a6d15aa --- /dev/null +++ b/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/src/c/statisticsFunctions/max/scolumnmaxa.c b/src/c/statisticsFunctions/max/scolumnmaxa.c index 71af846..4014f88 100644 --- a/src/c/statisticsFunctions/max/scolumnmaxa.c +++ b/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/src/c/statisticsFunctions/max/scolumnmaxa.c~ b/src/c/statisticsFunctions/max/scolumnmaxa.c~ new file mode 100644 index 0000000..4014f88 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/smaxa.c b/src/c/statisticsFunctions/max/smaxa.c index f47fcff..03b4cf1 100644 --- a/src/c/statisticsFunctions/max/smaxa.c +++ b/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/src/c/statisticsFunctions/max/smaxa.c~ b/src/c/statisticsFunctions/max/smaxa.c~ new file mode 100644 index 0000000..03b4cf1 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/srowmaxa.c b/src/c/statisticsFunctions/max/srowmaxa.c index c87ccf7..ea6c33d 100644 --- a/src/c/statisticsFunctions/max/srowmaxa.c +++ b/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/src/c/statisticsFunctions/max/srowmaxa.c~ b/src/c/statisticsFunctions/max/srowmaxa.c~ new file mode 100644 index 0000000..ea6c33d --- /dev/null +++ b/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/src/c/statisticsFunctions/max/testDoubleMax.c b/src/c/statisticsFunctions/max/testDoubleMax.c index 81c5032..883b427 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/testDoubleMax.c~ b/src/c/statisticsFunctions/max/testDoubleMax.c~ new file mode 100644 index 0000000..883b427 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/testFloatMax.c b/src/c/statisticsFunctions/max/testFloatMax.c index 7741aef..cb572f7 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/testFloatMax.c~ b/src/c/statisticsFunctions/max/testFloatMax.c~ new file mode 100644 index 0000000..cb572f7 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u16columnmaxa.c b/src/c/statisticsFunctions/max/u16columnmaxa.c new file mode 100644 index 0000000..e0ccb3a --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u16columnmaxa.c~ b/src/c/statisticsFunctions/max/u16columnmaxa.c~ new file mode 100644 index 0000000..e0ccb3a --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u16maxa.c b/src/c/statisticsFunctions/max/u16maxa.c new file mode 100644 index 0000000..c3af84f --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u16maxa.c~ b/src/c/statisticsFunctions/max/u16maxa.c~ new file mode 100644 index 0000000..c881d88 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u16rowmaxa.c b/src/c/statisticsFunctions/max/u16rowmaxa.c new file mode 100644 index 0000000..cef61f1 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u16rowmaxa.c~ b/src/c/statisticsFunctions/max/u16rowmaxa.c~ new file mode 100644 index 0000000..7c6b680 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u8columnmaxa.c b/src/c/statisticsFunctions/max/u8columnmaxa.c new file mode 100644 index 0000000..222bc29 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u8columnmaxa.c~ b/src/c/statisticsFunctions/max/u8columnmaxa.c~ new file mode 100644 index 0000000..e7f8f0e --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u8maxa.c b/src/c/statisticsFunctions/max/u8maxa.c new file mode 100644 index 0000000..3e59915 --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u8maxa.c~ b/src/c/statisticsFunctions/max/u8maxa.c~ new file mode 100644 index 0000000..d9b6eca --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u8rowmaxa.c b/src/c/statisticsFunctions/max/u8rowmaxa.c new file mode 100644 index 0000000..fda293c --- /dev/null +++ b/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/src/c/statisticsFunctions/max/u8rowmaxa.c~ b/src/c/statisticsFunctions/max/u8rowmaxa.c~ new file mode 100644 index 0000000..fda293c --- /dev/null +++ b/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]; + } + } +} |