From 138a344289d26d335968a1d6c338e9b7207efff2 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 16 Mar 2010 16:16:37 +0100 Subject: [PATCH] isl_pw_qpolynomial_upper_bound: set up variable vector after lifting A lifted cell may have more dimensions than the original, so we should wait until after the lifting to set up the variable vector. --- bernstein.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bernstein.cc b/bernstein.cc index 2934044..16f509b 100644 --- a/bernstein.cc +++ b/bernstein.cc @@ -813,6 +813,7 @@ static int guarded_qp_bernstein_coefficients(__isl_take isl_set *set, __isl_take isl_qpolynomial *qp, void *user) { struct isl_bound *bound = (struct isl_bound *)user; + unsigned nvar; Polyhedron *D; struct barvinok_options *options; evalue *e; @@ -822,6 +823,8 @@ static int guarded_qp_bernstein_coefficients(__isl_take isl_set *set, if (!set || !qp) goto error; + nvar = isl_set_dim(set, isl_dim_set); + e = isl_qpolynomial_to_evalue(qp); if (!e) goto error; @@ -829,6 +832,11 @@ static int guarded_qp_bernstein_coefficients(__isl_take isl_set *set, set = isl_set_make_disjoint(set); D = isl_set_to_polylib(set); + bound->vars = constructVariableVector(nvar, "v"); + bound->allvars = bound->vars; + bound->allvars.insert(bound->allvars.end(), + bound->params.begin(), bound->params.end()); + bound->pl = bernstein_coefficients_relation(bound->pl, D, e, bound->U, bound->allvars, bound->vars, bound->params, options); @@ -870,10 +878,6 @@ __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_upper_bound( bound.pl = NULL; bound.U = Universe_Polyhedron(nparam); bound.params = constructVariableVector(nparam, "p"); - bound.vars = constructVariableVector(nvar, "v"); - bound.allvars = bound.vars; - bound.allvars.insert(bound.allvars.end(), - bound.params.begin(), bound.params.end()); if (isl_pw_qpolynomial_foreach_lifted_piece(pwqp, guarded_qp_bernstein_coefficients, &bound)) -- 2.11.4.GIT