projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added a base parameter to the interaction_case_hash function
[pspp]
/
src
/
math
/
covariance.c
diff --git
a/src/math/covariance.c
b/src/math/covariance.c
index 5dc1782638aff4f294253fd20d87c4e6b2e4c426..f64e89d1eb2ffbee673c2179e6d2e48b78d066f3 100644
(file)
--- a/
src/math/covariance.c
+++ b/
src/math/covariance.c
@@
-25,6
+25,7
@@
#include "libpspp/assertion.h"
#include "libpspp/misc.h"
#include "math/categoricals.h"
#include "libpspp/assertion.h"
#include "libpspp/misc.h"
#include "math/categoricals.h"
+#include "math/interaction.h"
#include "math/moments.h"
#include "gl/xalloc.h"
#include "math/moments.h"
#include "gl/xalloc.h"
@@
-247,7
+248,7
@@
is_missing (const struct covariance *cov, int i, const struct ccase *c)
{
const struct variable *var = i < cov->n_vars ?
cov->vars[i] :
{
const struct variable *var = i < cov->n_vars ?
cov->vars[i] :
- categoricals_get_
variable_by_subscript (cov->categoricals, i - cov->n_vars)
;
+ categoricals_get_
interaction_by_subscript (cov->categoricals, i - cov->n_vars)->vars[0]
;
const union value *val = case_data (c, var);
const union value *val = case_data (c, var);
@@
-346,11
+347,13
@@
covariance_accumulate_pass2 (struct covariance *cov, const struct ccase *c)
assert (cov->state == 1);
cov->state = 2;
assert (cov->state == 1);
cov->state = 2;
+ if (cov->categoricals)
+ categoricals_done (cov->categoricals);
+
cov->dim = cov->n_vars;
if (cov->categoricals)
cov->dim = cov->n_vars;
if (cov->categoricals)
- cov->dim += categoricals_total (cov->categoricals)
- - categoricals_get_n_variables (cov->categoricals);
+ cov->dim += categoricals_df_total (cov->categoricals);
cov->n_cm = (cov->dim * (cov->dim - 1) ) / 2;
cov->cm = xcalloc (sizeof *cov->cm, cov->n_cm);
cov->n_cm = (cov->dim * (cov->dim - 1) ) / 2;
cov->cm = xcalloc (sizeof *cov->cm, cov->n_cm);
@@
-362,9
+365,6
@@
covariance_accumulate_pass2 (struct covariance *cov, const struct ccase *c)
cov->moments[i] = resize_matrix (cov->moments[i], cov->dim);
}
cov->moments[i] = resize_matrix (cov->moments[i], cov->dim);
}
- if (cov->categoricals)
- categoricals_done (cov->categoricals);
-
/* Populate the moments matrices with the categorical value elements */
for (i = cov->n_vars; i < cov->dim; ++i)
{
/* Populate the moments matrices with the categorical value elements */
for (i = cov->n_vars; i < cov->dim; ++i)
{