From f8b3152711379ddad2b887e3e706bba26c750c99 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 7 Apr 2008 23:28:08 +0200 Subject: [PATCH] evalue_bernstein_coefficients: handle problems with empty parametric polytope In particular, in bernstein_coefficients_periodic, some of the modulo classes may result in an empty problem and the recursive call should handle this situation. --- bernstein.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bernstein.cc b/bernstein.cc index ebe6809..b0d0865 100644 --- a/bernstein.cc +++ b/bernstein.cc @@ -343,6 +343,9 @@ static piecewise_lst *bernstein_coefficients_recursive(piecewise_lst *pl_all, } done += dims[j]; + + if (!pl) + return pl_all; } if (!pl_all) @@ -503,7 +506,8 @@ static piecewise_lst *bernstein_coefficients_polyhedron(piecewise_lst *pl_all, PP_MaxRays = 0; Param_Polyhedron *PP = Polyhedron2Param_Domain(P, ctx, PP_MaxRays); - assert(PP); + if (!PP) + return pl_all; piecewise_lst *pl = new piecewise_lst(params, options->bernstein_optimize); int nd = -1; @@ -588,7 +592,7 @@ static piecewise_lst *bernstein_coefficients_periodic(piecewise_lst *pl_all, Polyhedron *E = DomainPreimage(D, T, options->MaxRays); Polyhedron *F = DomainPreimage(E, T2, options->MaxRays); Polyhedron_Free(E); - if (!emptyQ2(F)) + if (!emptyQ(F)) pl_all = bernstein_coefficients(pl_all, F, poly, ctx, params, vars, options); Polyhedron_Free(F); -- 2.11.4.GIT