+ mean_matrix = covariance_moments (all_cov, MOMENT_MEAN);
+ ssize_matrix = covariance_moments (all_cov, MOMENT_NONE);
+ for (i = 0; i < cov->size1 - 1; i++)
+ {
+ means[i] = gsl_matrix_get (mean_matrix, rows[i], 0)
+ / gsl_matrix_get (ssize_matrix, rows[i], 0);
+ for (j = 0; j < cov->size2 - 1; j++)
+ {
+ gsl_matrix_set (cov, i, j, gsl_matrix_get (cm, rows[i], rows[j]));
+ gsl_matrix_set (cov, j, i, gsl_matrix_get (cm, rows[j], rows[i]));
+ }
+ }
+ means[cov->size1 - 1] = gsl_matrix_get (mean_matrix, dep_subscript, 0)
+ / gsl_matrix_get (ssize_matrix, dep_subscript, 0);
+ ssizes = covariance_moments (all_cov, MOMENT_NONE);
+ result = gsl_matrix_get (ssizes, dep_subscript, rows[0]);
+ for (i = 0; i < cov->size1 - 1; i++)
+ {
+ gsl_matrix_set (cov, i, cov->size1 - 1,
+ gsl_matrix_get (cm, rows[i], dep_subscript));
+ gsl_matrix_set (cov, cov->size1 - 1, i,
+ gsl_matrix_get (cm, rows[i], dep_subscript));
+ if (result > gsl_matrix_get (ssizes, rows[i], dep_subscript))
+ {
+ result = gsl_matrix_get (ssizes, rows[i], dep_subscript);
+ }
+ }
+ gsl_matrix_set (cov, cov->size1 - 1, cov->size1 - 1,
+ gsl_matrix_get (cm, dep_subscript, dep_subscript));
+ free (rows);
+ gsl_matrix_free (cm);
+ return result;