Registered Member
|
What the best way to sort values in a dense matrix row? For columns, I have been using the data() member to get a pointer to sort with, as in:
But this fails for sorting rows because the data() pointer is in column order. I was hoping there would be standard iterators for rows or columns blocks, but I couldn't find any in the docs. So what's the best solution? |
Registered Member
|
Well I ended up writing a generic iterator that works with Eigen containers (pasted below). This allows you to iterate over any type that has size() and operator[](int) member functions.
It allows you to use it like:
Or any other algorithm in the c++ standard library. Here's the iterator code:
|
Moderator
|
thank you for sharing this code, until we integrate such a feature directly inside Eigen, I'm sure it will be very useful to a couple of users.
|
Registered Member
|
I was looking to iterate over rows in Eigen and ended up here. Has this been implemented in Eigen?
|
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient