#include //#include // Index matrix (by columns) #define mi(i, j, d1, d2) (j*d1 + i) // Index 3-tensor (by columns, matrices ordered by last dim) #define ti(i, j, k, d1, d2, d3) (k*d1*d2 + j*d1 + i) // Empirical cross-moment of order 2 between X size nxd and Y size n void Moments_M2(double* X, double* Y, int* pn, int* pd, double* M2) { int n=*pn, d=*pd; //double* M2 = (double*)calloc(d*d,sizeof(double)); // M2 = E[Y*X^*2] - E[Y*e^*2] = E[Y (X^*2 - I)] for (int j=0; j= 1 ? nc : omp_get_num_procs()); // #pragma omp parallel for for (int i=0; i=0; k--) W[baseIdx+k] += gj * g[k]; } } // Normalize W: x 1/n for (int j=0; j j for (int j=0; j