
Module: ppl/ppl Branch: sparse_matrices Commit: e0501c1ec140e8e7a6767d87e4e24e60b1f0137b URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=e0501c1ec140e...
Author: Marco Poletti poletti.marco@gmail.com Date: Tue Mar 9 22:15:56 2010 +0100
PIP_Problem: add another version of static function neg_assign_row(), optimized for sparse rows.
---
src/PIP_Tree.cc | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc index c14f369..9583548 100644 --- a/src/PIP_Tree.cc +++ b/src/PIP_Tree.cc @@ -203,7 +203,8 @@ merge_assign(PIP_Tree_Node::matrix_type& x, } }
-// Assigns to row x the negation of row y. +#ifndef USE_PPL_SPARSE_MATRIX + inline void neg_assign_row(PIP_Tree_Node::matrix_row_reference_type x, PIP_Tree_Node::matrix_row_const_reference_type y) { @@ -211,6 +212,21 @@ neg_assign_row(PIP_Tree_Node::matrix_row_reference_type x, neg_assign(x[i], y[i]); }
+#else + +// Assigns to row x the negation of row y. +inline void +neg_assign_row(PIP_Tree_Node::matrix_row_reference_type x, + PIP_Tree_Node::matrix_row_const_reference_type y) { + x = y; + PIP_Tree_Node::matrix_row_iterator i = x.begin(); + PIP_Tree_Node::matrix_row_iterator i_end = x.end(); + for ( ; i!=i_end; ++i) + neg_assign((*i).second); +} + +#endif // !defined(USE_PPL_SPARSE_MATRIX) + // Given context row \p y and denominator \p den, // to be interpreted as expression expr = y / den, // assigns to context row \p x a new value such that