add isl_pw_qpolynomial_project_out
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 16 Aug 2011 09:29:54 +0000 (11:29 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 3 Sep 2011 10:04:55 +0000 (12:04 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_polynomial_private.h
isl_pw_templ.c

index 6c5334e..eb0a268 100644 (file)
@@ -156,6 +156,10 @@ __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_piece(
        __isl_take isl_set *set, __isl_take isl_qpolynomial *qp);
 int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial *pwqp);
 
+__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_project_out(
+       __isl_take isl_pw_qpolynomial *pwqp,
+       enum isl_dim_type type, unsigned first, unsigned n);
+
 __isl_give isl_qpolynomial *isl_qpolynomial_opt_on_domain(
        __isl_take isl_qpolynomial *qp, __isl_take isl_set *set, int max);
 
index 281c2c1..aa5fda4 100644 (file)
@@ -790,6 +790,42 @@ error:
        FN(PW,free)(pw);
        return NULL;
 }
+
+/* This function is very similar to drop_dims.
+ * The only difference is that the cells may still involve
+ * the specified dimensions.  They are removed using
+ * isl_set_project_out instead of isl_set_drop.
+ */
+__isl_give PW *FN(PW,project_out)(__isl_take PW *pw,
+       enum isl_dim_type type, unsigned first, unsigned n)
+{
+       int i;
+
+       if (!pw)
+               return NULL;
+       if (n == 0 && !isl_space_get_tuple_name(pw->dim, type))
+               return pw;
+
+       pw = FN(PW,cow)(pw);
+       if (!pw)
+               return NULL;
+       pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
+       if (!pw->dim)
+               goto error;
+       for (i = 0; i < pw->n; ++i) {
+               pw->p[i].set = isl_set_project_out(pw->p[i].set, type, first, n);
+               if (!pw->p[i].set)
+                       goto error;
+               pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
+               if (!pw->p[i].FIELD)
+                       goto error;
+       }
+
+       return pw;
+error:
+       FN(PW,free)(pw);
+       return NULL;
+}
 #endif
 
 #ifndef NO_INSERT_DIMS