*/
-
struct interaction *
interaction_create (const struct variable *v)
{
return i;
}
+/* Deep copy an interaction */
+struct interaction *
+interaction_clone (const struct interaction *iact)
+{
+ int v;
+ struct interaction *i = xmalloc (sizeof *i);
+ i->vars = xcalloc (iact->n_vars, sizeof *i->vars);
+ i->n_vars = iact->n_vars;
+
+ for (v = 0; v < iact->n_vars; ++v)
+ {
+ i->vars[v] = iact->vars[v];
+ }
+
+ return i;
+}
+
+
void
interaction_destroy (struct interaction *i)
{
+ if (NULL == i)
+ return;
+
free (i->vars);
free (i);
}
}
unsigned int
-interaction_case_hash (const struct interaction *iact, const struct ccase *c)
+interaction_case_hash (const struct interaction *iact, const struct ccase *c, unsigned int base)
{
int i;
- size_t hash = 0;
+ size_t hash = base;
for (i = 0; i < iact->n_vars; ++i)
{
const struct variable *var = iact->vars[i];