be identical. If missing values are involved, then element (i,j)
is the moment of the i th variable, when paired with the j th variable.
*/
-const gsl_matrix *
+gsl_matrix *
covariance_moments (const struct covariance *cov, int m)
{
return cov->moments[m];
bool centered)
{
size_t i;
- struct covariance *cov = xzalloc (sizeof *cov);
+ struct covariance *cov = XZALLOC (struct covariance);
cov->centered = centered;
cov->passes = 1;
const union value *val = case_data (c, var);
- return var_is_value_missing (var, val, cov->exclude);
+ return (var_is_value_missing (var, val) & cov->exclude) != 0;
}
covariance_accumulate_pass1 (struct covariance *cov, const struct ccase *c)
{
size_t i, j, m;
- const double weight = cov->wv ? case_data (c, cov->wv)->f : 1.0;
+ const double weight = cov->wv ? case_num (c, cov->wv) : 1.0;
assert (cov->passes == 2);
if (!cov->pass_one_first_case_seen)
covariance_accumulate_pass2 (struct covariance *cov, const struct ccase *c)
{
size_t i, j;
- const double weight = cov->wv ? case_data (c, cov->wv)->f : 1.0;
+ const double weight = cov->wv ? case_num (c, cov->wv) : 1.0;
assert (cov->passes == 2);
assert (cov->state >= 1);
covariance_accumulate (struct covariance *cov, const struct ccase *c)
{
size_t i, j, m;
- const double weight = cov->wv ? case_data (c, cov->wv)->f : 1.0;
+ const double weight = cov->wv ? case_num (c, cov->wv) : 1.0;
assert (cov->passes == 1);