[PPL-devel] [GIT] ppl/ppl(sparse_matrices): PIP_Solution_Node: optimize generate_cut() method for sparse matrices.

Marco Poletti poletti.marco at gmail.com
Wed Mar 24 14:45:17 CET 2010


Module: ppl/ppl
Branch: sparse_matrices
Commit: df30069d54bac2910ae48614bb4c664a7034924f
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=df30069d54bac2910ae48614bb4c664a7034924f

Author: Marco Poletti <poletti.marco at gmail.com>
Date:   Wed Mar 24 14:20:07 2010 +0100

PIP_Solution_Node: optimize generate_cut() method for sparse matrices.

---

 src/PIP_Tree.cc |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index 7fea489..3370301 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -3321,8 +3321,15 @@ PIP_Solution_Node::generate_cut(const dimension_type index,
   matrix_row_const_reference_type row_s = tableau.s[index];
   matrix_row_const_reference_type row_t = tableau.t[index];
   {
-    for (dimension_type j = 0; j < num_vars; ++j) {
-      mod_assign(cut_s[j], row_s[j], den);
+    matrix_row_const_iterator j = row_s.begin();
+    matrix_row_const_iterator j_end = row_s.end();
+    if (j != j_end) {
+      matrix_row_iterator itr = cut_s.find_create((*j).first);
+      mod_assign((*itr).second, (*j).second, den);
+      for (++j; j != j_end; ++j) {
+        itr = cut_s.find_create((*j).first, itr);
+        mod_assign((*itr).second, (*j).second, den);
+      }
     }
   }
   {




More information about the PPL-devel mailing list