From: John Darrington Date: Wed, 10 May 2017 10:48:17 +0000 (+0200) Subject: FACTOR: Use consistent indexing when displaying matrices. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e25423f795545ca2bb69edede7ab73c24a89dc8;p=pspp FACTOR: Use consistent indexing when displaying matrices. In any sane use case this will make no difference, since all covariance and correlation matrices are symetrical. However for correctness and ease of debugging this helps. --- diff --git a/src/language/stats/factor.c b/src/language/stats/factor.c index 8a38082bfa..6100279555 100644 --- a/src/language/stats/factor.c +++ b/src/language/stats/factor.c @@ -1969,7 +1969,7 @@ show_factor_correlation (const struct cmd_factor * factor, const gsl_matrix *fcm for (i = 0 ; i < fcm->size1; ++i) { for (j = 0 ; j < fcm->size2; ++j) - tab_double (t, heading_columns + i, heading_rows +j, 0, + tab_double (t, heading_columns + j, heading_rows + i, 0, gsl_matrix_get (fcm, i, j), NULL, RC_OTHER); } @@ -2065,7 +2065,7 @@ show_correlation_matrix (const struct cmd_factor *factor, const struct idata *id for (i = 0; i < factor->n_vars; ++i) { for (j = 0; j < factor->n_vars; ++j) - tab_double (t, heading_columns + i, y + j, 0, gsl_matrix_get (idata->mm.corr, i, j), NULL, RC_OTHER); + tab_double (t, heading_columns + j, y + i, 0, gsl_matrix_get (idata->mm.corr, i, j), NULL, RC_OTHER); } } @@ -2084,7 +2084,7 @@ show_correlation_matrix (const struct cmd_factor *factor, const struct idata *id if (i == j) continue; - tab_double (t, heading_columns + i, y + j, 0, significance_of_correlation (rho, w), NULL, RC_PVALUE); + tab_double (t, heading_columns + j, y + i, 0, significance_of_correlation (rho, w), NULL, RC_PVALUE); } } } @@ -2177,7 +2177,7 @@ show_covariance_matrix (const struct cmd_factor *factor, const struct idata *ida for (i = 0; i < factor->n_vars; ++i) { for (j = 0; j < factor->n_vars; ++j) - tab_double (t, heading_columns + i, y + j, 0, gsl_matrix_get (idata->mm.cov, i, j), NULL, RC_OTHER); + tab_double (t, heading_columns + j, y + i, 0, gsl_matrix_get (idata->mm.cov, i, j), NULL, RC_OTHER); } } }