[PPL-devel] [GIT] ppl/ppl(sparse_matrices): Sparse_Row, Sparse_Row_Reference: add reset_after() methods.

Marco Poletti poletti.marco at gmail.com
Tue Mar 9 22:16:05 CET 2010


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

Author: Marco Poletti <poletti.marco at gmail.com>
Date:   Tue Mar  9 14:28:51 2010 +0100

Sparse_Row, Sparse_Row_Reference: add reset_after() methods.

---

 src/Sparse_Row.defs.hh    |    6 ++++++
 src/Sparse_Row.inlines.hh |   14 ++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/Sparse_Row.defs.hh b/src/Sparse_Row.defs.hh
index 9402a40..16268c2 100644
--- a/src/Sparse_Row.defs.hh
+++ b/src/Sparse_Row.defs.hh
@@ -118,6 +118,9 @@ public:
   //! All dangerous_iterator objects in [first,last] are invalidated (note
   //! that last is invalidated, too).
   dangerous_iterator reset(dangerous_iterator first,dangerous_iterator last);
+  
+  //! Resets to zero the elements in [i,size()).
+  void reset_after(dimension_type i);
 
   //! Normalizes the modulo of coefficients so that they are mutually prime.
   /*!
@@ -238,6 +241,9 @@ public:
   //! invalidated (note that j_itr is invalidated, too).
   void reset(dimension_type i,dimension_type j);
 
+  //! Resets to zero the elements in [i,size()).
+  void reset_after(dimension_type i);
+
   //! Normalizes the modulo of coefficients so that they are mutually prime.
   /*!
     Computes the Greatest Common Divisor (GCD) among the elements of
diff --git a/src/Sparse_Row.inlines.hh b/src/Sparse_Row.inlines.hh
index 4d15e42..3301485 100644
--- a/src/Sparse_Row.inlines.hh
+++ b/src/Sparse_Row.inlines.hh
@@ -131,6 +131,13 @@ Sparse_Row::reset(dangerous_iterator first,dangerous_iterator last) {
 }
 
 inline void
+Sparse_Row::reset_after(dimension_type i) {
+  PPL_ASSERT(i < size_);
+  row.reset_after(i);
+  PPL_ASSERT(OK());
+}
+
+inline void
 Sparse_Row::normalize() {
   row.normalize();
   PPL_ASSERT(OK());
@@ -348,6 +355,13 @@ Sparse_Row_Reference::reset(const dimension_type first,
 }
 
 inline void
+Sparse_Row_Reference::reset_after(dimension_type i) {
+  PPL_ASSERT(i < size_);
+  row.reset_after(i);
+  PPL_ASSERT(OK());
+}
+
+inline void
 Sparse_Row_Reference::normalize() {
   row.normalize();
   PPL_ASSERT(OK());




More information about the PPL-devel mailing list