Re: [eigen] Pass column by reference

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


On Fri, May 21, 2010 at 12:29 PM, Carlos Becker <carlosbecker@xxxxxxxxx> wrote:
> Thanks, I will try them. I am thinking that it would be good to put this
> information in the tutorial since it seems to be happening to everyone I am
> coding with that is using Eigen, since it would seem as if VectorXf should
> succeed, but does not.

> Do you think there would be a way to include such a change in the future so
> that columns could be taken as vectors? I am not aware of the internals for
> this in Eigen, maybe it is a complete rewrite or has important
> disadvantages.

We can add this for sure to the documentation. I've even made a
mistake by declaring the arguments as references. They need to be
either value objects or rvalue references.

We will never be able to add what you are asking for and I also think
that it is not really intuitive what you are asking for. A matrix is
not a list of vectors and a column expression is giving you just a
view on a column. In particular, in case you want to write to the
matrix column, what you ask for is not possible.

Something like this is a different scenario:

void foo(VectorXf v) {}

Here you can easily call foo(m.col(i)) though you will cause the
creation of a temporary object. The column-expression will be copied
into the VectorXf.

HTH,
Hauke



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