+ // Normalize W: x 1/n
+ for (int j=0; j<dim; j++)
+ {
+ for (int k=0; k<=j; k++)
+ W[mi(j,k,dim,dim)] /= n;
+ }
+ // Symmetrize W: W[j,k] = W[k,j] for k > j
+ for (int j=0; j<dim; j++)
+ {
+ for (int k=j+1; k<dim; k++)
+ W[mi(j,k,dim,dim)] = W[mi(k,j,dim,dim)];
+ }