X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fcovariance.c;h=79fce25cef28362dbe7b404377d436e92727111c;hb=9574a6c2bf65ddc8ef13d4e942833bc5d4b0d2e0;hp=cd8ec2ffd1e68b24f783f2ea3c9ce42b7598fae5;hpb=96994a54e60e9c95b8bba54c2281acf7059b1203;p=pspp diff --git a/src/math/covariance.c b/src/math/covariance.c index cd8ec2ffd1..79fce25cef 100644 --- a/src/math/covariance.c +++ b/src/math/covariance.c @@ -129,7 +129,7 @@ struct covariance 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]; @@ -145,7 +145,7 @@ covariance_1pass_create (size_t n_vars, const struct variable *const *vars, bool centered) { size_t i; - struct covariance *cov = xzalloc (sizeof *cov); + struct covariance *cov = XZALLOC (struct covariance); cov->centered = centered; cov->passes = 1; @@ -262,7 +262,7 @@ is_missing (const struct covariance *cov, int i, const struct ccase *c) 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; } @@ -301,7 +301,7 @@ void 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) @@ -346,7 +346,7 @@ void 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); @@ -464,7 +464,7 @@ void 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);