Add ability to iterate (non-nested) over values in sparse matrix
Submitted by Matthew Woehlke
Assigned to Nobody
Link to original bugzilla bug (#1104)
Version: 3.4 (development)
Description
In modern C++, especially with range-based for, and considering that SparseMatrix::InnerIterator knows the row and column, it would be useful to have an iterator that allowed visiting every non-zero cell without a nested loop. For example:
for (auto iter : /adapt/(sparse_matrix))
{
static_assert(decltype(iter) == decltype(sparse_matrix)::InnerIterator);
// do stuff with iter
}
It's debatable if direct iteration should be permitted (and whether such should include zero cells also), or if construction of an adaptor would be required (different adaptors could provide sparse or dense iteration).
Depends on
Blocking
Edited by Eigen Bugzilla