From: Benjamin Auder Date: Tue, 14 Jan 2020 18:37:33 +0000 (+0100) Subject: It's enough to compute half of W (complete by symmetry) X-Git-Url: https://git.auder.net/variants/Chakart/pieces/doc/html/up.jpg?a=commitdiff_plain;h=9fdd3e5f57aa1fd0f839214d9cbfac022a8739a8;p=morpheus.git It's enough to compute half of W (complete by symmetry) --- diff --git a/pkg/src/functions.c b/pkg/src/functions.c index 94ea12d..6444b86 100644 --- a/pkg/src/functions.c +++ b/pkg/src/functions.c @@ -95,21 +95,27 @@ void Compute_Omega(double* X, int* Y, double* M, int* pnc, int* pn, int* pd, dou g[j] += Y[i] * X[mi(i,idx1,n,d)]*X[mi(i,idx2,n,d)]*X[mi(i,idx3,n,d)] - M[j]; } // Add 1/n t(gi) %*% gi to W - for (int j=dim-1; j>=0; j--) + for (int j=0; j=0; k--) + #pragma GCC unroll 32 + for (int k=j; k>=0; k--) W[baseIdx+k] += gj * g[k]; } } // Normalize W: x 1/n for (int j=0; j j + for (int j=0; j