From 0f2ee5213241398b03ed6aa42ff054128c07fd5a Mon Sep 17 00:00:00 2001 From: skimo Date: Sun, 19 Sep 2004 17:52:11 +0000 Subject: [PATCH] extract check for infinite parametric polytopes --- barvinok.cc | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/barvinok.cc b/barvinok.cc index a3c6563..5ff8287 100644 --- a/barvinok.cc +++ b/barvinok.cc @@ -1427,6 +1427,22 @@ static Polyhedron *reduce_domain(Polyhedron *D, Matrix *CT, Polyhedron *CEq, return rVD; } +static bool Polyhedron_is_infinite(Polyhedron *P, unsigned nparam) +{ + int r; + for (r = 0; r < P->NbRays; ++r) + if (value_zero_p(P->Ray[r][0]) || + value_zero_p(P->Ray[r][P->Dimension+1])) { + int i; + for (i = P->Dimension - nparam; i < P->Dimension; ++i) + if (value_notzero_p(P->Ray[r][i+1])) + break; + if (i >= P->Dimension) + break; + } + return r < P->NbRays; +} + evalue* barvinok_enumerate_ev(Polyhedron *P, Polyhedron* C, unsigned MaxRays) { //P = unfringe(P, MaxRays); @@ -1473,17 +1489,7 @@ out: return eres; } - for (r = 0; r < P->NbRays; ++r) - if (value_zero_p(P->Ray[r][0]) || - value_zero_p(P->Ray[r][P->Dimension+1])) { - int i; - for (i = P->Dimension - nparam; i < P->Dimension; ++i) - if (value_notzero_p(P->Ray[r][i+1])) - break; - if (i >= P->Dimension) - break; - } - if (r < P->NbRays) + if (Polyhedron_is_infinite(P, nparam)) goto constant; if (P->NbEq != 0) { -- 2.11.4.GIT