struct hmap_node *node ;
int x;
- printf ("\n%s (%d) CC=%g:\n", var_get_name (vp->var), vp->base_subscript, vp->cc);
-
- assert (vp->reverse_value_map);
+ 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)
node->cc = 0.0;
hmap_insert (&cat->vp[i].map, &node->node, hash);
- cat->n_cats_total ++;
+ cat->n_cats_total++;
node->subscript = cat->vp[i].n_cats++ ;
}
return &vn->value;
}
+
+double
+categoricals_get_weight_by_subscript (const struct categoricals *cat, int subscript)
+{
+ int vindex = cat->reverse_variable_map[subscript];
+ const struct var_params *vp = &cat->vp[vindex];
+
+ return vp->cc;
+}
+
+double
+categoricals_get_sum_by_subscript (const struct categoricals *cat, int subscript)
+{
+ int vindex = cat->reverse_variable_map[subscript];
+ const struct var_params *vp = &cat->vp[vindex];
+
+ const struct value_node *vn = vp->reverse_value_map [subscript - vp->base_subscript];
+ return vn->cc;
+}
+
+
/* Returns unity if the value in case C at SUBSCRIPT is equal to the category
for that subscript */
double