[PPL-devel] [GIT] ppl/ppl(sparse_matrices): PIP_Solution_Node: fix regression in solve( ), partially reverting commit d7f564.
Marco Poletti
poletti.marco at gmail.com
Tue Mar 16 13:48:08 CET 2010
Module: ppl/ppl
Branch: sparse_matrices
Commit: d043b85fec828b0bc79f711703c3e2298354e08d
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=d043b85fec828b0bc79f711703c3e2298354e08d
Author: Marco Poletti <poletti.marco at gmail.com>
Date: Tue Mar 16 13:44:05 2010 +0100
PIP_Solution_Node: fix regression in solve(), partially reverting commit d7f564.
---
src/PIP_Tree.cc | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index 469386f..e448c5b 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -2781,20 +2781,16 @@ PIP_Solution_Node::solve(const PIP_Problem& pip,
if (s_pivot_pj != pivot_den) {
for (dimension_type i = num_rows; i-- > 0; ) {
matrix_row_reference_type s_i = tableau.s[i];
- matrix_row_iterator itr = s_i.find(pj);
- if (itr != s_i.end()) {
- Coefficient& s_i_pj = (*itr).second;
- product = s_i_pj * pivot_den;
- if (product % s_pivot_pj != 0) {
- // As above, perform matrix scaling.
- gcd_assign(gcd, product, s_pivot_pj);
- exact_div_assign(scale_factor, s_pivot_pj, gcd);
- tableau.scale(scale_factor);
- product *= scale_factor;
- }
- PPL_ASSERT(product % s_pivot_pj == 0);
- exact_div_assign(s_i_pj, product, s_pivot_pj);
+ product = s_i[pj] * pivot_den;
+ if (product % s_pivot_pj != 0) {
+ // As above, perform matrix scaling.
+ gcd_assign(gcd, product, s_pivot_pj);
+ exact_div_assign(scale_factor, s_pivot_pj, gcd);
+ tableau.scale(scale_factor);
+ product *= scale_factor;
}
+ PPL_ASSERT(product % s_pivot_pj == 0);
+ exact_div_assign(s_i[pj], product, s_pivot_pj);
}
}
More information about the PPL-devel
mailing list