From 4b9c2689d47dc7db56685fbf2bcd9a1928e52bc1 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 21 Apr 2007 13:48:34 +0200 Subject: [PATCH] traiter: simplify constraints added to the context --- example/fimmel.ll | 6 +++--- example/max.ll | 10 +++++----- source/traiter.c | 8 ++++++-- test/max.ll | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/example/fimmel.ll b/example/fimmel.ll index 300b0d5..0b69c1d 100644 --- a/example/fimmel.ll +++ b/example/fimmel.ll @@ -13,14 +13,14 @@ 1 0 1 -1 0 0 1 1 0 0 -1 0 -(if #[ 0 -6 5] - (if #[ -18 0 25] +(if #[ 0 -1 0] + (if #[ -1 0 1] () () ) (if #[ 0 -1 5] (if #[ -3 -1 5] - (if #[ 0 -2 3] + (if #[ 0 -1 1] (newparm 2 (div #[ 0 1 1] 3)) (newparm 3 (div #[ 0 1 5 3] 6)) (newparm 4 (div #[ 0 2 0 1 0] 3)) diff --git a/example/max.ll b/example/max.ll index 6ece102..c16c99f 100644 --- a/example/max.ll +++ b/example/max.ll @@ -5,17 +5,17 @@ -1 - the constraint matrix. 4 5 - 1 -1 0 1 0 - 1 0 -1 1 0 - 1 -1 3 -2 12 - 1 2 -1 -1 3 + 1 -1 0 1 0 + 1 0 -1 1 0 + 1 -1 3 -2 12 + 1 2 -1 -1 3 (if #[ -1 3] (list #[ 0 0] #[ 0 0] ) - (if #[ -5 27] + (if #[ -1 5] (newparm 1 (div #[ 1 1] 2)) (list #[ 1 -1 -1] diff --git a/source/traiter.c b/source/traiter.c index 6029402..6b71181 100644 --- a/source/traiter.c +++ b/source/traiter.c @@ -783,12 +783,16 @@ int iq, nvar, nparm, ni, nc, bigparm; entier_init_zero(com_dem); for (j = 0; j < nparm; j++) entier_gcd(com_dem, com_dem, Index(tp, pivi, j + nvar +1)); - entier_gcd(com_dem, com_dem, Index(tp, pivi, nvar)); + if (!iq) + entier_gcd(com_dem, com_dem, Index(tp, pivi, nvar)); for (j = 0; j < nparm; j++) { entier_divexact(Index(context, nc, j), Index(tp, pivi, j + nvar + 1), com_dem); sol_val(Index(context, nc, j), UN); } - entier_divexact(Index(context, nc, nparm), Index(tp, pivi, nvar), com_dem); + if (!iq) + entier_divexact(Index(context, nc, nparm), Index(tp, pivi, nvar), com_dem); + else + entier_pdivision(Index(context, nc, nparm), Index(tp, pivi, nvar), com_dem); sol_val(Index(context, nc, nparm), UN); entier_clear(com_dem); Flag(context, nc) = Unknown; diff --git a/test/max.ll b/test/max.ll index fa1dd69..2398d93 100644 --- a/test/max.ll +++ b/test/max.ll @@ -3,7 +3,7 @@ (list #[ 0 0] #[ 0 0] ) -(if #[ -5 27] +(if #[ -1 5] (newparm 1 (div #[ 1 1] 2) ) -- 2.11.4.GIT