[GIT] ppl/ppl(master): Corrected a (checked-integer related) problem in PIP_Solution_Tree::solve().

Module: ppl/ppl Branch: master Commit: 215c270204d965b2baa0463ebdb62f2f88f575f0 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=215c270204d96...
Author: Enea Zaffanella zaffanella@cs.unipr.it Date: Mon Feb 14 19:14:13 2011 +0100
Corrected a (checked-integer related) problem in PIP_Solution_Tree::solve(). Updated expected results for 32-bits checked integers: ppl_pips test lineri.dat no longer overflows.
---
demos/ppl_pips/expected_int32 | 2 +- demos/ppl_pips/expected_int32_a | 2 +- src/PIP_Tree.cc | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/demos/ppl_pips/expected_int32 b/demos/ppl_pips/expected_int32 index d3581a3..cb13f0d 100644 --- a/demos/ppl_pips/expected_int32 +++ b/demos/ppl_pips/expected_int32 @@ -1,6 +1,6 @@ invert.dat 89eb267478eb8675de9602be9bb92f9e - linear.dat 1f73e09130d92979eb4388cbbab7f389 - -lineri.dat d41d8cd98f00b204e9800998ecf8427e - +lineri.dat 7b21035f6f07e68b8c0e2893a649f0ef - loz.dat 558273607bb0eec59c713980a8722ac8 - max.dat 2c3f32340ed2ea04d070dd311e9ca188 - maxb.dat bc9d718f581cd7da4bbd7f0293749315 - diff --git a/demos/ppl_pips/expected_int32_a b/demos/ppl_pips/expected_int32_a index d3581a3..cb13f0d 100644 --- a/demos/ppl_pips/expected_int32_a +++ b/demos/ppl_pips/expected_int32_a @@ -1,6 +1,6 @@ invert.dat 89eb267478eb8675de9602be9bb92f9e - linear.dat 1f73e09130d92979eb4388cbbab7f389 - -lineri.dat d41d8cd98f00b204e9800998ecf8427e - +lineri.dat 7b21035f6f07e68b8c0e2893a649f0ef - loz.dat 558273607bb0eec59c713980a8722ac8 - max.dat 2c3f32340ed2ea04d070dd311e9ca188 - maxb.dat bc9d718f581cd7da4bbd7f0293749315 - diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc index f6ff537..58fc66b 100644 --- a/src/PIP_Tree.cc +++ b/src/PIP_Tree.cc @@ -2643,14 +2643,15 @@ PIP_Solution_Node::solve(const PIP_Problem& pip, for (dimension_type i = num_rows; i-- > 0; ) { Row& s_i = tableau.s[i]; Row& t_i = tableau.t[i]; - Coefficient_traits::const_reference s_i_pj = s_i.get(pj); Row::iterator k = t_i.end(); for (Row::const_iterator j = t_pivot.begin(), j_end = t_pivot.end(); j != j_end; ++j) { Coefficient_traits::const_reference t_pivot_j = *j; // Do nothing if the j-th pivot element is zero. if (t_pivot_j != 0) { - product = t_pivot_j * s_i_pj; + /* NOTE: s_i[pj] needs to be recomputed at each iteration, + as it may have been modified by tableau.scale(). */ + product = t_pivot_j * s_i.get(pj); if (product % s_pivot_pj != 0) { // Must scale matrix to stay in integer case. gcd_assign(gcd, product, s_pivot_pj);
participants (1)
-
Enea Zaffanella