Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • eigen eigen
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 653
    • Issues 653
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Custom issue tracker
    • Custom issue tracker
  • Merge requests 17
    • Merge requests 17
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • libeigen
  • eigeneigen
  • Issues
  • #1340
Closed
Open
Created Dec 04, 2019 by Eigen Bugzilla@eigenbzReporter

Add operator + to sparse matrix iterator

Submitted by Valentin Roussellet

Assigned to Valentin Roussellet

Link to original bugzilla bug (#1340)
Version: 3.3 (current stable)

Description

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;
}

Blocking

#814 (closed)

Edited Dec 05, 2019 by Eigen Bugzilla
Assignee
Assign to
Time tracking