diff options
author | Brijeshcr | 2017-08-04 17:58:41 +0530 |
---|---|---|
committer | Brijeshcr | 2017-08-04 17:58:41 +0530 |
commit | 0fad6a05ae4e0aad6b05c10905d5e40493bcc587 (patch) | |
tree | 79a288ef7add5ec4a765600dd837be2b8e502f4c /2.3-1/src/c/statisticsFunctions/center/zcentercola.c | |
parent | 08907f873ad769a7f2326d15c9a20a84bcef5008 (diff) | |
download | Scilab2C-0fad6a05ae4e0aad6b05c10905d5e40493bcc587.tar.gz Scilab2C-0fad6a05ae4e0aad6b05c10905d5e40493bcc587.tar.bz2 Scilab2C-0fad6a05ae4e0aad6b05c10905d5e40493bcc587.zip |
Added Center, Wcenter and Correl
Diffstat (limited to '2.3-1/src/c/statisticsFunctions/center/zcentercola.c')
-rw-r--r-- | 2.3-1/src/c/statisticsFunctions/center/zcentercola.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/2.3-1/src/c/statisticsFunctions/center/zcentercola.c b/2.3-1/src/c/statisticsFunctions/center/zcentercola.c new file mode 100644 index 00000000..8a838bc5 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/center/zcentercola.c @@ -0,0 +1,42 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "center.h" +#include "doubleComplex.h" +#include "sqrt.h" + +void zcentercola (doubleComplex* inp, int row, int col, doubleComplex* out) +{ + + doubleComplex sum[row], xbar[row]; + for(int i = 0; i < row; i++) + sum[i] = DoubleComplex(0,0); + + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] = zadds(sum[i], inp[i + j*row]); + } + } + + + for(int i = 0; i < row; i++) + xbar[i] = zrdivs(sum[i], col); + + doubleComplex one[col]; // Creating a matrix of ones + zonesa(one,1,col); + + + doubleComplex prod[row*col]; + zmulma(xbar, row, 1, one, 1, col, prod); + + for(int i = 0; i< row*col; i++) + out[i] = zdiffs(inp[i], prod[i]); +} |