SparseCompressedBase::InnerIterator has operator++ but no operator += or operator + There are cases where one may want to advance the operator by N elements. Currently, the only way to do it is with a for loop such as : for (i = 0; i < N; ++i,++iterator) {} An addition operator is easy to define within the iterator : inline InnerIterator& operator+=( _Index i ) { m_id += i; return *this; } inline InnerIterator operator+( _Index i ) { InnerIterator result = *this; result += i; return result; } Similarly, a substraction operator can be added to ReverseIterator inline ReverseInnerIterator& operator-=( _Index i ) { m_id -= i; return *this; } inline ReverseInnerIterator operator-( _Index i ) { ReverseInnerIterator result = *this; result -= i; return result; }
with s/_Index/Index or Eigen 3.3, of course.
Why not. Feel free to propose a patch. There are two instances to be updated in Eigen/src/SparseCore/SparseCompressedBase.h and Eigen/src/Core/CoreIterators.h respectively.
I submitted pull request #284 with a proposed patch for this issue https://bitbucket.org/eigen/eigen/pull-requests/284/proposed-patch-for-bug-1340/diff
https://bitbucket.org/eigen/eigen/commits/21315953153c/
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1340.