[PPL-devel] [GIT] ppl/ppl(sparse_matrices): PIP_Tree.cc: use assign_if_nonzero() instead of reinventing the wheel, in merge_assign().

Marco Poletti poletti.marco at gmail.com
Mon Mar 22 21:46:53 CET 2010


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

Author: Marco Poletti <poletti.marco at gmail.com>
Date:   Mon Mar 22 21:36:00 2010 +0100

PIP_Tree.cc: use assign_if_nonzero() instead of reinventing the wheel, in merge_assign().

---

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

diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index d1b5dcd..0b2963b 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -377,8 +377,7 @@ merge_assign(PIP_Tree_Node::matrix_type& x,
     PPL_ASSERT(y_i->is_nonstrict_inequality());
     PIP_Tree_Node::matrix_row_reference_type x_i = x[i];
     const Coefficient& inhomogeneous_term = y_i->inhomogeneous_term();
-    if (inhomogeneous_term != 0)
-      x_i[0] = inhomogeneous_term;
+    x_i.assign_if_nonzero(0, inhomogeneous_term);
     Variables_Set::const_iterator pj;
     dimension_type j = 1;
     PIP_Tree_Node::matrix_row_iterator last = x_i.begin();




More information about the PPL-devel mailing list