{
struct design_matrix *cov;
struct design_matrix *ssize;
- struct design_matrix *means;
+ struct design_matrix *sums;
struct hsh_table *ca;
struct moments1 **m1;
struct moments **m;
assert (cov != NULL);
design_matrix_destroy (cov->cov);
design_matrix_destroy (cov->ssize);
- design_matrix_destroy (cov->means);
+ design_matrix_destroy (cov->sums);
hsh_destroy (cov->ca);
if (cov->n_pass == ONE_PASS)
{
cov->cov = covariance_matrix_create (cov->n_variables, cov->v_variables);
cov->ssize = covariance_matrix_create (cov->n_variables, cov->v_variables);
- cov->means = covariance_matrix_create (cov->n_variables, cov->v_variables);
+ cov->sums = covariance_matrix_create (cov->n_variables, cov->v_variables);
for (i = 0; i < design_matrix_get_n_cols (cov->cov); i++)
{
sum_i = get_sum (cov, i);
{
sum_j = get_sum (cov, j);
entry = hsh_first (cov->ca, &iter);
-
+ gsl_matrix_set (cov->sums->m, i, j, sum_i);
while (entry != NULL)
{
update_ssize (cov->ssize, i, j, entry);
*/
if (is_covariance_contributor (entry, cov->cov, i, j))
{
-
covariance_matrix_insert (cov->cov, entry->v1, entry->v2, entry->val1,
entry->val2, entry->dot_product);
}
entry = hsh_next (cov->ca, &iter);
}
tmp = gsl_matrix_get (cov->cov->m, i, j);
- tmp -= gsl_matrix_get (cov->means->m, i, j) / gsl_matrix_get (cov->ssize->m, i, j);
+ tmp -= sum_i * sum_j / gsl_matrix_get (cov->ssize->m, i, j);
gsl_matrix_set (cov->cov->m, i, j, tmp);
-
}
}
}