+void
+categoricals_destroy ( struct categoricals *cat)
+{
+ int i;
+ if (cat != NULL)
+ {
+ for (i = 0 ; i < cat->n_vp; ++i)
+ hmap_destroy (&cat->vp[i].map);
+
+ pool_destroy (cat->pool);
+ free (cat);
+ }
+}
+
+
+#if 0
+void
+categoricals_dump (const struct categoricals *cat)
+{
+ int v;
+
+ for (v = 0 ; v < cat->n_vp; ++v)
+ {
+ const struct var_params *vp = &cat->vp[v];
+ const struct hmap *m = &vp->map;
+ struct hmap_node *node ;
+ int x;
+
+ printf ("\n%s (%d) CC=%g n_cats=%d:\n",
+ var_get_name (vp->var), vp->base_subscript, vp->cc, vp->n_cats);
+
+ printf ("Reverse map\n");
+ for (x = 0 ; x < vp->n_cats; ++x)
+ {
+ struct string s;
+ const struct value_node *vn = vp->reverse_value_map[x];
+ ds_init_empty (&s);
+ var_append_value_name (vp->var, &vn->value, &s);
+ printf ("Value for %d is %s\n", x, ds_cstr(&s));
+ ds_destroy (&s);
+ }
+
+ printf ("\nForward map\n");
+ for (node = hmap_first (m); node; node = hmap_next (m, node))
+ {
+ struct string s;
+ const struct value_node *vn = HMAP_DATA (node, struct value_node, node);
+ ds_init_empty (&s);
+ var_append_value_name (vp->var, &vn->value, &s);
+ printf ("Value: %s; Index %d; CC %g\n",
+ ds_cstr (&s),
+ vn->subscript, vn->cc);
+ ds_destroy (&s);
+ }
+ }
+
+ assert (cat->n_vars <= cat->n_vp);
+
+ printf ("\n");
+ printf ("Number of categorical variables: %d\n", cat->n_vp);
+ printf ("Number of non-empty categorical variables: %d\n", cat->n_vars);
+ printf ("Total number of categories: %d\n", cat->n_cats_total);
+
+ printf ("\nReverse variable map:\n");
+
+ for (v = 0 ; v < cat->n_cats_total; ++v)
+ printf ("%d ", cat->reverse_variable_map[v]);
+ printf ("\n");
+}
+#endif
+