add isl_pw_qpolynomial_from_qpolynomial
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 25 Jul 2011 06:57:56 +0000 (08:57 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 28 Jul 2011 14:43:08 +0000 (16:43 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/polynomial.h
isl_polynomial.c

index 3ad2b0a..96020d2 100644 (file)
@@ -2812,6 +2812,8 @@ be combined to create more complicated piecewise quasipolynomials.
        __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
                __isl_take isl_set *set,
                __isl_take isl_qpolynomial *qp);
+       __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_from_qpolynomial(
+               __isl_take isl_qpolynomial *qp);
 
        __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_zero(
                __isl_take isl_dim *dim);
index b9935ef..bcd5b45 100644 (file)
@@ -145,6 +145,8 @@ isl_ctx *isl_pw_qpolynomial_get_ctx(__isl_keep isl_pw_qpolynomial *pwqp);
 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(__isl_take isl_dim *dim);
 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(__isl_take isl_set *set,
        __isl_take isl_qpolynomial *qp);
+__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_from_qpolynomial(
+       __isl_take isl_qpolynomial *qp);
 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
        __isl_keep isl_pw_qpolynomial *pwqp);
 void *isl_pw_qpolynomial_free(__isl_take isl_pw_qpolynomial *pwqp);
index abd752b..b566902 100644 (file)
@@ -2518,6 +2518,23 @@ error:
        return NULL;
 }
 
+__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_from_qpolynomial(
+       __isl_take isl_qpolynomial *qp)
+{
+       isl_set *dom;
+
+       if (!qp)
+               return NULL;
+       if (isl_qpolynomial_is_zero(qp)) {
+               isl_dim *dim = isl_qpolynomial_get_dim(qp);
+               isl_qpolynomial_free(qp);
+               return isl_pw_qpolynomial_zero(dim);
+       }
+
+       dom = isl_set_universe(isl_qpolynomial_get_dim(qp));
+       return isl_pw_qpolynomial_alloc(dom, qp);
+}
+
 #undef PW
 #define PW isl_pw_qpolynomial
 #undef EL