- result = gsl_vector_calloc (length);
- subs = xnmalloc (n_vars, sizeof (*subs));
- for (j = 0; j < n_vars; j++)
- {
- if (var_is_alpha (v[j]))
- {
- subs[j] = cat_value_find (v[j], vals[j]);
- }
- }
- j = subs[0];
- for (i = 1; i < n_vars; i++)
- {
- j = j * cat_get_n_categories (v[i]) + subs[i];
- }
- gsl_vector_set (result, j, 1.0);
- /*
- If any of the variables are numeric, the interaction of that
- variable with another is just a scalar product.
- */
- for (i = 1; i < n_vars; i++)
+void interaction_variable_destroy (struct interaction_variable *iv)
+{
+ var_destroy (iv->intr);
+ free (iv->members);
+ free (iv);
+}
+
+size_t
+interaction_variable_get_n_vars (const struct interaction_variable *iv)
+{
+ return (iv == NULL) ? 0 : iv->n_vars;
+}
+
+/*
+ Given list of values, compute the value of the corresponding
+ interaction. This "value" is not stored as the typical vector of
+ 0's and one double, but rather the string values are concatenated to
+ make one big string value, and the numerical values are multiplied
+ together to give the non-zero entry of the corresponding vector.
+ */
+struct interaction_value *
+interaction_value_create (const struct interaction_variable *var, const union value **vals)
+{
+ struct interaction_value *result = NULL;
+ size_t i;
+ size_t n_vars;
+
+ if (var != NULL)