Re: [eigen] Eigen "views"

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


On 16.08.2011 08:48, Gael Guennebaud wrote:
I confirm what Benoit said, this has yet to be implemented and this is
probably the most wanted feature!

API-wise, what about simply overloading operator(). For vectors:

VectorXf v1, v2;
VectorXi indices;

v2 = v1(indices);

And for matrices:

MatrixXf m1, m2;
VectorXi indices1, indices2;

m2 = m1(indices1,indices2);
m2 = m1(Eigen::All,indices2);
m2 = m1(indices1,Eigen::All);

Yes, I think this looks as close as one can get to Matlab-syntax (not that this is a requirement, but it's definitely not a bad thing).

"m1(indices1)" would be forbidden for matrices.

Maybe the constant "All" is too intrusive when someone do using
namespace Eigen ??

It definitely should be a separate type, not a constant, similar problem/solution as in resize. In principle it would be nice to reuse the same type, though I agree that NoChange, might be counter-intuitive here.

Christoph

--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252
----------------------------------------------



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