diff options
author | jofret | 2008-06-19 06:25:03 +0000 |
---|---|---|
committer | jofret | 2008-06-19 06:25:03 +0000 |
commit | 24f104a091afa9749e31a963f21a3d861bd74325 (patch) | |
tree | 9a8ce73626ea2718ed3fcfe409f1c483f050a9f8 /src/statisticsFunctions | |
parent | 2d8a026f583f4cd5e976b3e54f0a83d9fdaf68f5 (diff) | |
download | scilab2c-24f104a091afa9749e31a963f21a3d861bd74325.tar.gz scilab2c-24f104a091afa9749e31a963f21a3d861bd74325.tar.bz2 scilab2c-24f104a091afa9749e31a963f21a3d861bd74325.zip |
- Add Column ways sum operation
Diffstat (limited to 'src/statisticsFunctions')
-rw-r--r-- | src/statisticsFunctions/sum/ccolumnsuma.c | 33 | ||||
-rw-r--r-- | src/statisticsFunctions/sum/dcolumnsuma.c | 33 | ||||
-rw-r--r-- | src/statisticsFunctions/sum/scolumnsuma.c | 33 | ||||
-rw-r--r-- | src/statisticsFunctions/sum/zcolumnsuma.c | 33 |
4 files changed, 132 insertions, 0 deletions
diff --git a/src/statisticsFunctions/sum/ccolumnsuma.c b/src/statisticsFunctions/sum/ccolumnsuma.c new file mode 100644 index 00000000..64018cdc --- /dev/null +++ b/src/statisticsFunctions/sum/ccolumnsuma.c @@ -0,0 +1,33 @@ +/* + * 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 "sum.h" + +void ccolumnsuma(floatComplex *in, int lines, int columns, floatComplex * 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] = in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = cadds(out[i % lines] , in[i]); + } +} diff --git a/src/statisticsFunctions/sum/dcolumnsuma.c b/src/statisticsFunctions/sum/dcolumnsuma.c new file mode 100644 index 00000000..1f9b479d --- /dev/null +++ b/src/statisticsFunctions/sum/dcolumnsuma.c @@ -0,0 +1,33 @@ +/* + * 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 "sum.h" + +void dcolumnsuma(double *in, int lines, int columns, double * 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] = in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] += in[i]; + } +} diff --git a/src/statisticsFunctions/sum/scolumnsuma.c b/src/statisticsFunctions/sum/scolumnsuma.c new file mode 100644 index 00000000..4d2415f2 --- /dev/null +++ b/src/statisticsFunctions/sum/scolumnsuma.c @@ -0,0 +1,33 @@ +/* + * 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 "sum.h" + +void scolumnsuma(float *in, int lines, int columns, float * 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] = in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] += in[i]; + } +} diff --git a/src/statisticsFunctions/sum/zcolumnsuma.c b/src/statisticsFunctions/sum/zcolumnsuma.c new file mode 100644 index 00000000..93e97536 --- /dev/null +++ b/src/statisticsFunctions/sum/zcolumnsuma.c @@ -0,0 +1,33 @@ +/* + * 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 "sum.h" + +void zcolumnsuma(doubleComplex *in, int lines, int columns, doubleComplex * 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] = in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = zadds(out[i % lines] , in[i]); + } +} |