diff options
author | Brijeshcr | 2017-08-04 17:58:41 +0530 |
---|---|---|
committer | Brijeshcr | 2017-08-04 17:58:41 +0530 |
commit | ee498f417540084c08cf335a03cdefcd3fa853e4 (patch) | |
tree | 57baa6014bb85da001014ab74468a6922f5f6b2a /src/c/statisticsFunctions/center/dcentercola.c | |
parent | e47a705e2a330fc6745ad406d04d63075df65492 (diff) | |
download | scilab2c-ee498f417540084c08cf335a03cdefcd3fa853e4.tar.gz scilab2c-ee498f417540084c08cf335a03cdefcd3fa853e4.tar.bz2 scilab2c-ee498f417540084c08cf335a03cdefcd3fa853e4.zip |
Added Center, Wcenter and Correl
Diffstat (limited to 'src/c/statisticsFunctions/center/dcentercola.c')
-rw-r--r-- | src/c/statisticsFunctions/center/dcentercola.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/c/statisticsFunctions/center/dcentercola.c b/src/c/statisticsFunctions/center/dcentercola.c new file mode 100644 index 00000000..e92a1d29 --- /dev/null +++ b/src/c/statisticsFunctions/center/dcentercola.c @@ -0,0 +1,38 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "center.h" + +void dcentercola (double* inp, int row, int col, double* out) +{ + + double sum[row], xbar[row]; + for(int i = 0; i < row; i++) + sum[i] = 0; + + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] += inp[i + j*row]; + } + } + + + for(int i = 0; i < row; i++) + xbar[i] = sum[i]/col; + + double one[col]; // Creating a matrix of ones + donesa(one,1,col); + + + double prod[row*col]; + dmulma(xbar, row, 1, one, 1, col, prod); + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; +} |