+/*
+ Do the variables in X->VARS constitute a proper
+ subset of the variables in Y->VARS?
+ */
+static bool
+is_subset (struct interaction *x, struct interaction *y)
+{
+ size_t i;
+ size_t j;
+ size_t n = 0;
+
+ if (x->n_vars < y->n_vars)
+ {
+ for (i = 0; i < x->n_vars; i++)
+ {
+ for (j = 0; j < y->n_vars; j++)
+ {
+ if (x->vars [i] == y->vars [j])
+ {
+ n++;
+ }
+ }
+ }
+ }
+ if (n >= x->n_vars)
+ return true;
+ return false;
+}
+
+static bool
+drop_from_submodel (struct interaction *x, struct interaction *y)
+{
+ size_t i;
+ size_t j;
+ size_t n = 0;
+
+ if (is_subset (x, y))
+ return true;
+
+ for (i = 0; i < x->n_vars; i++)
+ for (j = 0; j < y->n_vars; j++)
+ {
+ if (x->vars [i] == y->vars [j])
+ n++;
+ }
+ if (n == x->n_vars)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+static void
+fill_submatrix (gsl_matrix * cov, gsl_matrix * submatrix, size_t * dropped,
+ size_t n_dropped)
+{
+ size_t i;
+ size_t j;
+ size_t n = 0;
+ size_t m = 0;
+
+ for (i = 0; i < cov->size1; i++)
+ {
+ if (not_dropped (i, dropped, n_dropped))
+ {
+ m = 0;
+ for (j = 0; j < cov->size2; j++)
+ {
+ if (not_dropped (j, dropped, n_dropped))
+ {
+ gsl_matrix_set (submatrix, n, m,
+ gsl_matrix_get (cov, i, j));
+ m++;
+ }
+ }
+ n++;
+ }
+ }
+}
+