From 46d1ea5727d44900bdd6c470b58c9899e36d124b Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 13 Aug 2006 11:49:48 +0200 Subject: [PATCH] lexmin.cc: don't bother transforming if compress_parms returns a translation For some reason, recent versions of compress_parms can return a translation where previous versions would return an identity matrix. There is no point in going to the effort of transforming the polyhedron and performing the back substitution for a translation. --- lexmin.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lexmin.cc b/lexmin.cc index 95dc9c4..ad52ba2 100644 --- a/lexmin.cc +++ b/lexmin.cc @@ -1886,6 +1886,24 @@ static vector lexmin(indicator& ind, EDomain *D, unsigned nparam, return maxima; } +static bool isTranslation(Matrix *M) +{ + unsigned i, j; + if (M->NbRows != M->NbColumns) + return False; + + for (i = 0;i < M->NbRows; i ++) + for (j = 0; j < M->NbColumns-1; j ++) + if (i == j) { + if(value_notone_p(M->p[i][j])) + return False; + } else { + if(value_notzero_p(M->p[i][j])) + return False; + } + return value_one_p(M->p[M->NbRows-1][M->NbColumns-1]); +} + static Matrix *compress_parameters(Polyhedron **P, Polyhedron **C, unsigned nparam, unsigned MaxRays) { @@ -1900,7 +1918,7 @@ static Matrix *compress_parameters(Polyhedron **P, Polyhedron **C, CP = compress_parms(M, nparam); Matrix_Free(M); - if (isIdentity(CP)) { + if (isTranslation(CP)) { Matrix_Free(CP); return NULL; } -- 2.11.4.GIT