- result = gsl_vector_calloc (length);
- subs = xnmalloc (n_vars, sizeof (*subs));
- for (j = 0; j < n_vars; j++)
+ return result;
+}
+void interaction_variable_destroy (struct interaction_variable *iv)
+{
+ var_destroy (iv->intr);
+ free (iv->members);
+ free (iv);
+}
+
+/*
+ Get one of the member variables.
+ */
+const struct variable *
+interaction_get_member (const struct interaction_variable *iv, size_t i)
+{
+ return iv->members[i];
+}
+
+size_t
+interaction_get_n_vars (const struct interaction_variable *iv)
+{
+ return (iv == NULL) ? 0 : iv->n_vars;
+}
+
+size_t
+interaction_get_n_alpha (const struct interaction_variable *iv)
+{
+ return iv->n_alpha;
+}
+
+size_t
+interaction_get_n_numeric (const struct interaction_variable *iv)
+{
+ return (interaction_get_n_vars (iv) - interaction_get_n_alpha (iv));
+}
+
+/*
+ Get the interaction variable itself.
+ */
+const struct variable *
+interaction_get_variable (const struct interaction_variable *iv)
+{
+ return iv->intr;
+}
+/*
+ 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;
+ const struct variable *member;
+ size_t i;
+ size_t n_vars;
+
+ if (var != NULL)