+
+ for (i = 0; i < design_matrix_get_n_cols (cov->cov); i++)
+ {
+ sum_i = get_sum (cov, i);
+ for (j = i; j < design_matrix_get_n_cols (cov->cov); j++)
+ {
+ sum_j = get_sum (cov, j);
+ entry = hsh_first (cov->ca, &iter);
+ while (entry != NULL)
+ {
+ update_ssize (cov->ssize, i, j, entry);
+ /*
+ We compute the centered, un-normalized covariance matrix.
+ */
+ if (is_covariance_contributor (entry, cov->cov, i, j))
+ {
+ design_matrix_set_element (cov->cov, i, j, entry->dot_product);
+ }
+ entry = hsh_next (cov->ca, &iter);
+ }
+ tmp = design_matrix_get_element (cov->cov, i, j);
+ tmp -= sum_i * sum_j / design_matrix_get_element (cov->ssize, i, j);
+ design_matrix_set_element (cov->cov, i, j, tmp);
+ design_matrix_set_element (cov->cov, j, i, tmp);
+ }
+ }