- {
- int v;
- struct string str;
- const struct interact_params *iap = &cat->iap[i];
- const struct interaction *iact = iap->iact;
-
- ds_init_empty (&str);
- interaction_to_string (iact, &str);
-
- printf ("\nInteraction: \"%s\" (number of categories: %d); ", ds_cstr (&str), iap->n_cats);
- ds_destroy (&str);
- printf ("Base index (df/categories): %d/%d\n", iap->base_df, iap->base_cats);
-
- printf ("\t(");
- for (v = 0; v < hmap_count (&iap->ivmap); ++v)
- {
- int vv;
- const struct interaction_value *iv = iap->ivs[v];
-
- if (v > 0) printf (" ");
- printf ("{");
- for (vv = 0; vv < iact->n_vars; ++vv)
- {
- const struct variable *var = iact->vars[vv];
- const union value *val = case_data (iv->ccase, var);
- struct variable_node *vn = iap->varnodes[vv];
- const int width = var_get_width (var);
- unsigned int valhash = value_hash (val, width, 0);
- struct value_node *valn = lookup_value (&vn->valmap, val, valhash, width);
-
- assert (vn->var == var);
-
- printf ("%.*g(%d)", DBL_DIG + 1, val->f, valn->index);
- if (vv < iact->n_vars - 1)
- printf (", ");
- }
- printf ("}");
- }
- printf (")\n");
- }
+ {
+ int v;
+ struct string str;
+ const struct interact_params *iap = &cat->iap[i];
+ const struct interaction *iact = iap->iact;
+
+ ds_init_empty (&str);
+ interaction_to_string (iact, &str);
+
+ printf ("\nInteraction: \"%s\" (number of categories: %d); ", ds_cstr (&str), iap->n_cats);
+ ds_destroy (&str);
+ printf ("Base index (df/categories): %d/%d\n", iap->base_df, iap->base_cats);
+
+ printf ("\t(");
+ for (v = 0; v < hmap_count (&iap->ivmap); ++v)
+ {
+ int vv;
+ const struct interaction_value *iv = iap->ivs[v];
+
+ if (v > 0) printf (" ");
+ printf ("{");
+ for (vv = 0; vv < iact->n_vars; ++vv)
+ {
+ const struct variable *var = iact->vars[vv];
+ const union value *val = case_data (iv->ccase, var);
+ struct variable_node *vn = iap->varnodes[vv];
+ const int width = var_get_width (var);
+ unsigned int valhash = value_hash (val, width, 0);
+ struct value_node *valn = lookup_value (&vn->valmap, val, valhash, width);
+
+ assert (vn->var == var);
+
+ printf ("%.*g(%d)", DBL_DIG + 1, val->f, valn->index);
+ if (vv < iact->n_vars - 1)
+ printf (", ");
+ }
+ printf ("}");
+ }
+ printf (")\n");
+ }
/* Unref any cases that we reffed. */
struct interaction_value *iv;
HMAP_FOR_EACH (iv, struct interaction_value, node, &cat->iap[i].ivmap)
/* Unref any cases that we reffed. */
struct interaction_value *iv;
HMAP_FOR_EACH (iv, struct interaction_value, node, &cat->iap[i].ivmap)
- {
- if (cat->payload && cat->payload->destroy)
- cat->payload->destroy (cat->aux1, cat->aux2, iv->user_data);
- case_unref (iv->ccase);
- }
+ {
+ if (cat->payload && cat->payload->destroy)
+ cat->payload->destroy (cat->aux1, cat->aux2, iv->user_data);
+ case_unref (iv->ccase);
+ }
- {
- const struct variable *var = inter[i]->vars[v];
- unsigned int hash = hash_pointer (var, 0);
- struct variable_node *vn = lookup_variable (&cat->varmap, var, hash);
- if (!vn)
- {
- vn = pool_malloc (cat->pool, sizeof *vn);
- vn->var = var;
- hmap_init (&vn->valmap);
- hmap_insert (&cat->varmap, &vn->node, hash);
- }
+ {
+ const struct variable *var = inter[i]->vars[v];
+ unsigned int hash = hash_pointer (var, 0);
+ struct variable_node *vn = lookup_variable (&cat->varmap, var, hash);
+ if (!vn)
+ {
+ vn = pool_malloc (cat->pool, sizeof *vn);
+ vn->var = var;
+ hmap_init (&vn->valmap);
+ hmap_insert (&cat->varmap, &vn->node, hash);
+ }
- {
- valn = pool_malloc (cat->pool, sizeof *valn);
- valn->index = -1;
- value_init (&valn->val, width);
- value_copy (&valn->val, val, width);
- hmap_insert (&vn->valmap, &valn->node, hash);
- }
+ {
+ valn = pool_malloc (cat->pool, sizeof *valn);
+ valn->index = -1;
+ value_init (&valn->val, width);
+ value_copy (&valn->val, val, width);
+ hmap_insert (&vn->valmap, &valn->node, hash);
+ }
struct interact_params *iap = &cat->iap[i];
const struct interaction *iact = iap->iact;
if (interaction_case_is_missing (iact, c, cat->fctr_excl))
struct interact_params *iap = &cat->iap[i];
const struct interaction *iact = iap->iact;
if (interaction_case_is_missing (iact, c, cat->fctr_excl))
unsigned int hash = interaction_case_hash (iact, c, 0);
struct interaction_value *node = lookup_case (&iap->ivmap, iact, c);
if (!node)
unsigned int hash = interaction_case_hash (iact, c, 0);
struct interaction_value *node = lookup_case (&iap->ivmap, iact, c);
if (!node)
- iap->enc_sum[x - iap->base_df] += bin * iv->cc;
- }
- if (cat->payload && cat->payload->calculate)
- cat->payload->calculate (cat->aux1, cat->aux2, iv->user_data);
- }
+ iap->enc_sum[x - iap->base_df] += bin * iv->cc;
+ }
+ if (cat->payload && cat->payload->calculate)
+ cat->payload->calculate (cat->aux1, cat->aux2, iv->user_data);
+ }