Re: [eigen] Iterators with dense matrices 2 |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Iterators with dense matrices 2
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sun, 21 Feb 2010 19:40:52 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=rh+j3DL1/wQp38mfdKG+Qp/coLmhNNVa0SS4o4CKYXw=; b=pcvGvHP9zUQ/iLtH38TirmR65Jq04YSwdKbhNyJ2R3PtVnR9Ij81VY3Zacw8AIdcFV M3r0PRDvzA29tPhqccrInHigtjsm0TZBYiadnFK1/G8Tj6A3ZpGIkwdgMOh8ZGC3sKu6 n1DIeWtulFdSM1uQ+0+Nws9BHD6LSGCC50U+U=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=W5OfoGN/zyMOdcgKYlv9eST1QAfN7q1ACvODRPcXpx/uQjhhY3CX3cCa06NHCi1CD/ hGviDRd2PaykeFGsTTCd5LnzCGkyKLKzzAwDRNkfdDzd8gKK5Lpy852MEEjg7Zyg/3cu tjA6VxTF65Ir06MZ59nfK+6fmmjaUsKf7K94g=
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
>