Re: [eigen] A vector indexed by another vector |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
On 24.08.2012 16:31, Matthieu Brucher wrote:
This has been requested several times, essentially this is directly what
bug 329 wants to have:
http://eigen.tuxfamily.org/bz/**show_bug.cgi?id=329<http://eigen.tuxfamily.org/bz/show_bug.cgi?id=329>
There is a prototype implementation, I'm not sure how well it worked/works
with the current Eigen version.
If, however, the offset array is a permutation, i.e. each index occurs
exactly once, you should be able to solve it using:
http://eigen.tuxfamily.org/**dox-devel/classEigen_1_**
1PermutationMatrix.html<http://eigen.tuxfamily.org/dox-devel/classEigen_1_1PermutationMatrix.html>
Thanks for the pointers. Unfortunately, I know that there are indices that
will not be used. We do skip some values depending on a parameter at the
beginning of the process, so perhaps duplicating data would be an
acceptable solution (although a memory- and time-costly one, there are
dozens of arrays that may or may not be needed).
No, duplicating the data definitely is not an option, both for reasons
of performance and elegance-of-code.
The cleanest solution, obviously, would be to fix bug 329 ;).
Until you or someone else does so, I would recommend keeping the old code.
If you really need to go for performance, it might be an option to
extract all data which is indexed via offset[j] manually into
temporaries. That way the remaining expression could even benefit from
SSE-vectorization. However, this obviously might be memory-costly.
Christoph
--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen
Tel: +49 (421) 218-64252
----------------------------------------------