summaryrefslogtreecommitdiff
path: root/isl_bound.c
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2010-06-07 14:43:26 +0200
committerSven Verdoolaege <skimo@kotnet.org>2010-06-12 17:34:01 +0200
commit7790c83aff93eb8352bd37e340c7ff9956315b8b (patch)
tree9ccbbf6d042548d6aaa578eda9f20142a49e0720 /isl_bound.c
parent7679c371ce969bd88e3d7990dc340b96fc0cc0fd (diff)
downloadisl-7790c83aff93eb8352bd37e340c7ff9956315b8b.tar.gz
isl-7790c83aff93eb8352bd37e340c7ff9956315b8b.tar.bz2
isl-7790c83aff93eb8352bd37e340c7ff9956315b8b.zip
optionally (and by default) use bernstein expansion to compute bounds
Diffstat (limited to 'isl_bound.c')
-rw-r--r--isl_bound.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/isl_bound.c b/isl_bound.c
index 40e4d5e2..7660d045 100644
--- a/isl_bound.c
+++ b/isl_bound.c
@@ -9,14 +9,40 @@
*/
#include <isl_bound.h>
+#include <isl_bernstein.h>
#include <isl_range.h>
#include <isl_polynomial_private.h>
+/* Compute a bound on the polynomial defined over the parametric polytope
+ * using either range propagation or bernstein expansion and
+ * store the result in bound->pwf and bound->pwf_tight.
+ * Since bernstein expansion requires bounded domains, we apply
+ * range propagation on unbounded domains. Otherwise, we respect the choice
+ * of the user.
+ */
static int compressed_guarded_poly_bound(__isl_take isl_basic_set *bset,
__isl_take isl_qpolynomial *poly, void *user)
{
struct isl_bound *bound = (struct isl_bound *)user;
- return isl_qpolynomial_bound_on_domain_range(bset, poly, bound);
+ int bounded;
+
+ if (!bset || !poly)
+ goto error;
+
+ if (bset->ctx->opt->bound == ISL_BOUND_RANGE)
+ return isl_qpolynomial_bound_on_domain_range(bset, poly, bound);
+
+ bounded = isl_basic_set_is_bounded(bset);
+ if (bounded < 0)
+ goto error;
+ if (bounded)
+ return isl_qpolynomial_bound_on_domain_bernstein(bset, poly, bound);
+ else
+ return isl_qpolynomial_bound_on_domain_range(bset, poly, bound);
+error:
+ isl_basic_set_free(bset);
+ isl_qpolynomial_free(poly);
+ return -1;
}
static int guarded_poly_bound(__isl_take isl_basic_set *bset,