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

Marco Poletti poletti.marco at gmail.com
Wed Mar 17 23:10:21 CET 2010


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

Author: Marco Poletti <poletti.marco at gmail.com>
Date:   Wed Mar 17 23:10:30 2010 +0100

PIP_Problem: optimize solve() method for sparse matrices.

---

 src/PIP_Problem.cc |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PIP_Problem.cc b/src/PIP_Problem.cc
index 3eca9e7..71a798f 100644
--- a/src/PIP_Problem.cc
+++ b/src/PIP_Problem.cc
@@ -204,8 +204,10 @@ PPL::PIP_Problem::solve() const {
 
         // If it is an equality, also insert its negation.
         if (c.is_equality()) {
-          for (dimension_type i = new_num_cols; i-- > 0; )
-            neg_assign(row[i], row[i]);
+          matrix_row_iterator i = row.begin();
+          matrix_row_iterator i_end = row.end();
+          for ( ; i!=i_end; ++i)
+            neg_assign((*i).second);
 
           // Insert new row into initial context.
           x.initial_context.add_row(row);




More information about the PPL-devel mailing list