From d1b1a4765ccc518616d4019c5a19a025e3ec2b15 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 19 Feb 2007 13:01:03 +0100 Subject: [PATCH] DomainIncludes: detect more cases + adapt documentation --- doc/Internal.tex | 6 +++--- util.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/Internal.tex b/doc/Internal.tex index ed7c7a7..f96099d 100644 --- a/doc/Internal.tex +++ b/doc/Internal.tex @@ -938,14 +938,14 @@ The function \ai[\tt]{unimodular\_complete} extends algorithm of \shortciteN{Bik1996PhD}. \begin{verbatim} -int DomainIncludes(Polyhedron *Pol1, Polyhedron *Pol2); +int DomainIncludes(Polyhedron *D1, Polyhedron *D2); \end{verbatim} The function \ai[\tt]{DomainIncludes} extends the function \ai[\tt]{PolyhedronIncludes} provided by \PolyLib/ to unions of polyhedra. -It checks whether its first argument is a superset of -its second argument. +It checks whether every polyhedron in the union {\tt D2} +is included in some polyhedron of {\tt D1}. \begin{verbatim} Polyhedron *DomainConstraintSimplify(Polyhedron *P, diff --git a/util.c b/util.c index 1b507a1..aaafc9a 100644 --- a/util.c +++ b/util.c @@ -982,17 +982,18 @@ void Free_ParamNames(char **params, int m) free(params); } -int DomainIncludes(Polyhedron *Pol1, Polyhedron *Pol2) +/* Check whether every set in D2 is included in some set of D1 */ +int DomainIncludes(Polyhedron *D1, Polyhedron *D2) { - Polyhedron *P2; - for ( ; Pol1; Pol1 = Pol1->next) { - for (P2 = Pol2; P2; P2 = P2->next) - if (!PolyhedronIncludes(Pol1, P2)) + for ( ; D2; D2 = D2->next) { + Polyhedron *P1; + for (P1 = D1; P1; P1 = P1->next) + if (PolyhedronIncludes(P1, D2)) break; - if (!P2) - return 1; + if (!P1) + return 0; } - return 0; + return 1; } int line_minmax(Polyhedron *I, Value *min, Value *max) -- 2.11.4.GIT