struct hmap valmap; /* A map of value nodes */
};
+#if 0
static void
dump_interaction (const struct interaction *iact)
{
printf ("Interaction: %s\n", ds_cstr (&str));
ds_destroy (&str);
}
+#endif
static struct variable_node *
void *aux2;
};
-
+#if 0
static void
categoricals_dump (const struct categoricals *cat)
{
printf (")\n");
}
}
-
+#endif
void
categoricals_destroy (struct categoricals *cat)
{
+ struct variable_node *vn = NULL;
+ int i;
+ if (NULL == cat)
+ return;
+ for (i = 0; i < cat->n_iap; ++i)
+ {
+ struct interaction_value *iv = NULL;
+ /* Interate over each interaction value, and unref any cases that we reffed */
+ HMAP_FOR_EACH (iv, struct interaction_value, node, &cat->iap[i].ivmap)
+ {
+ case_unref (iv->ccase);
+ }
+ hmap_destroy (&cat->iap[i].ivmap);
+ }
+
+ /* Interate over each variable and delete its value map */
+ HMAP_FOR_EACH (vn, struct variable_node, node, &cat->varmap)
+ {
+ hmap_destroy (&vn->valmap);
+ }
+
+ hmap_destroy (&cat->varmap);
+
+ pool_destroy (cat->pool);
+
free (cat);
}
sort (iap->reverse_interaction_value_map, x, sizeof (*iap->reverse_interaction_value_map),
compare_interaction_value_3way, iap);
+ /* Fill the remaining values with null */
+ for (ii = x ; ii < iap->n_cats; ++ii)
+ iap->reverse_interaction_value_map[ii] = NULL;
+
/* Populate the reverse variable maps. */
for (ii = 0; ii < iap->df; ++ii)
cat->reverse_variable_map_short[idx_short++] = i;
int vindex = reverse_variable_lookup_short (cat, subscript);
const struct interact_params *vp = &cat->iap[vindex];
const struct interaction_value *vn = vp->reverse_interaction_value_map [subscript - vp->base_subscript_short];
+
+ if ( vn == NULL)
+ return NULL;
+
return vn->ccase;
}
const struct interaction_value *iv = vp->reverse_interaction_value_map [subscript - vp->base_subscript_short];
+ if (iv == NULL)
+ return 0;
+
return iv->cc;
}
const struct ccase *c2 = categoricals_get_case_by_subscript (cat, subscript);
+ if ( c2 == NULL)
+ return 0;
+
return interaction_case_equal (iact, c, c2);
}