{
gsl_matrix_set (d->m, row, col, x);
}
+
+/*
+ Return the subscript of the column of the design matrix
+ corresponding to VAL. If VAR is categorical with d categories, its
+ first category should correspond to the origin in d-dimensional
+ Euclidean space, so there is no subscript for this value.
+ */
+size_t
+dm_get_exact_subscript (const struct design_matrix *dm, const struct variable *var,
+ const union value *val)
+{
+ size_t result;
+
+ result = design_matrix_var_to_column (dm, var);
+ if (var_is_alpha (var))
+ {
+ if (cat_is_origin (var, val))
+ {
+ return -1u;
+ }
+ result += cat_value_find (var, val) - 1;
+ }
+ return result;
+}