[GIT] ppl/ppl(master): PIP_Solution_Node: avoid repeated lookup of Sparse_Row's coefficients, in solve().

Module: ppl/ppl Branch: master Commit: b956c5822426119ce1bfa2ad7f305cfff6db7148 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=b956c58224261...
Author: Marco Poletti poletti.marco@gmail.com Date: Thu Feb 17 13:02:00 2011 +0100
PIP_Solution_Node: avoid repeated lookup of Sparse_Row's coefficients, in solve().
---
src/PIP_Tree.cc | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc index 416abad..bc1c494 100644 --- a/src/PIP_Tree.cc +++ b/src/PIP_Tree.cc @@ -2639,16 +2639,19 @@ PIP_Solution_Node::solve(const PIP_Problem& pip, Row& s_i = tableau.s[i]; Row& t_i = tableau.t[i];
- if (s_i.get(pj) == 0) + Row::iterator s_i_pj_itr = s_i.find(pj); + + if (s_i_pj_itr == s_i.end()) continue;
- // NOTE: For sparse rows, the non-const operator[] ensures that - // the element is actually stored in the row. At this point, however, - // it can't be zero, so it is already stored in the row. // NOTE: This is a Coefficient& instead of a // Coefficient_traits::const_reference, because scale() may silently // modify it. - Coefficient& s_i_pj = s_i[pj]; + Coefficient& s_i_pj = *s_i_pj_itr; + + if (s_i_pj == 0) + continue; + Row::iterator k = t_i.end(); for (Row::const_iterator j = t_pivot.begin(), j_end = t_pivot.end(); j != j_end; ++j) {
participants (1)
-
Marco Poletti