Re: [eigen] Iterators with dense matrices 2

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


And, I re-read the old thread, at some point Gael mentions that it
might be possible to use the Sparse iterators on dense matrices right
now. Definitely something to try first!

Here's the relevant part of his e-mail...

---BEGIN GAEL EMAIL---

- I think that sparse iterator works for dense expressions as well, so
you can already write your own generic loops for dense/sparse objects,
for the record:

for(int outer=0;outer<m.outerSize(); ++outer)
for(MatrixType::InnerIterator it(m, outer); it; ++it)
{
 // here you can use:
 it.value();
 it.index();
 it.col();
 it.row();
}

2010/2/21 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> Hi,
>
> To summarize the current situation:
>  - we agree on the potential usefulness of iterators and would be OK
> to have them in Eigen.
>  - we already renamed the old end() function to tail() so that the
> name "end()" is now available to be used for iterator stuff (and
> begin() is available too).
>  - but we are currently focusing on finishing Eigen 3.0 and this is
> not a priority for us as this is a feature addition that can be made
> at a later date.
>  - patches welcome :) but anyone trying to write such a patch would
> have to pay attention to consistency with the Sparse module which
> already has iterators.
>
>> Still, iterator support might be helpful to re-use algorithms that take
>> iterators as input. But there is a much easier solution to achieve that
>> (at least that's how I solved this problem): just use both interfaces in
>> parallel. For example, initialise your matrix as uBlas matrix and then
>> initialise an Eigen2 matrix using exactly the same block of memory
>> occupied by the original uBlas matrix.
>
> Indeed, you can do that by mapping the memory buffer using Map<MatrixType>.
>
> Cheers,
> Benoit
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/