Re: [eigen] On the implementation of STL iterator for Eigen::Matrix |

[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]

Dear Gael,
Am 02.10.2018 um 14:53 schrieb Gael Guennebaud:

for(auto x : A.rowwise()) { ... }
Is it obvious to everyone that this line is iterating over the rows of A and is thus a synonym for:
for(int i=0;i<A.rows();++i) { auto x = A.row(i); ... }

My first thought was "why using rowwise() if we already have A.rows()",
followed by "so it must be the elements of the rows".
In results, I find it precise, and obvious after thinking about it.

`On my side, I'm rather reading it as "iterate over all elements of A in row-major order", which is unfortunate as if I'm not alone with such an interpretation, then we need to come up with new names. Since rows()/cols() are
`

Not my interpretation.

already taken, we could think of:
for(auto x : A.allRows()) { ... }
for(auto x : A.rowSet()) { ... }
?????

I'd prefer A.rowwise().
Best regards,
Peter