|Re: [eigen] On the implementation of STL iterator for Eigen::Matrix|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
> On Oct 2, 2018, at 6:38 PM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:
> we're eventually implementing STL iterators to iterator over the coefficients of a vector/matrix as well as over the columns or rows of a matrix, and your inputs might be welcome to help converging to a stable API, see below.
> You can watch the WIP in PR 519 , and find some background in bug 231 . Basically, to avoid ambiguities, we decided that iterators over coefficients would be defined for 1D expression only, meaning that to iterate over the elements of a 2D Matrix you'll have to explicitly reshape it as a 1D vector first.
Have you considered a solution such as used by Boost GIL (Generic Image Library)? That has the concept of "pixel locators" which allow both 1-D and 2-D (i.e., up/down, right/left) movement through the pixels of an image.
In fact, I would be surprised if you cannot adapt a matrix to the GIL "image" concept and get a whole lot for free.
In any case, I think it would be worth investigating before you settle on the arbitrary restriction of a 1-D-only API.