struct interact_params
{
+ /* The interaction, and an array with iact->n_vars elements such that
+ varnodes[x] points to the variable_node for iact->vars[x]. */
+ const struct interaction *iact;
+ struct variable_node **varnodes;
+
/* An example of each interaction that appears in the data, like a frequency
table for 'iact'. By construction, the number of elements must be less
than or equal to 'n_cats'.
struct hmap ivmap;
struct interaction_value **ivs;
- const struct interaction *iact;
-
int base_df;
int base_cats;
{
const struct variable *var = iact->vars[vv];
const union value *val = case_data (iv->ccase, var);
- unsigned int varhash = hash_pointer (var, 0);
- struct variable_node *vn = lookup_variable (&cat->varmap, var, varhash);
+ struct variable_node *vn = iap->varnodes[vv];
const int width = var_get_width (var);
unsigned int valhash = value_hash (val, width, 0);
hmap_init (&cat->iap[i].ivmap);
cat->iap[i].iact = inter[i];
cat->iap[i].cc = 0.0;
+ cat->iap[i].varnodes = pool_nmalloc (cat->pool, cat->iap[i].iact->n_vars,
+ sizeof *cat->iap[i].varnodes);
for (v = 0; v < inter[i]->n_vars; ++v)
{
const struct variable *var = inter[i]->vars[v];
hmap_insert (&cat->varmap, &vn->node, hash);
}
+ cat->iap[i].varnodes[v] = vn;
}
}
for (v = 0 ; v < iact->n_vars; ++v)
{
- const struct variable *var = iact->vars[v];
- struct variable_node *vn = lookup_variable (&cat->varmap, var, hash_pointer (var, 0));
+ struct variable_node *vn = cat->iap[i].varnodes[v];
cat->iap[i].df_prod[v] = df * (vn->n_vals - 1);
df = cat->iap[i].df_prod[v];
const union value *val = case_data (c, var);
const int width = var_get_width (var);
- const struct variable_node *vn = lookup_variable (&cat->varmap, var, hash_pointer (var, 0));
+ const struct variable_node *vn = iap->varnodes[v];
const unsigned int hash = value_hash (val, width, 0);
const struct value_node *valn = lookup_value (&vn->valmap, val, hash, width);