Re: [eigen] Enabled move support for Matrix and Array

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


First, I really had to fix the typo in the subject. ;)

On Tue, May 3, 2011 at 10:49 AM, Eamon Nerbonne <eamon@xxxxxxxxxxxx> wrote:
> Hey, that's really cool!  Does this also improve return value scenarios?
> e.g.
>
> MatrixXd m1(myfunc1()  + myfunc2());
>
> or maybe
>
> MatrixXd m1(std::move(myfunc1())  + std::move(myfunc2()));

Your examples will result in old-school Eigen behavior. The + will
return an expressions and for that the MatrixBase<OtherDerived>
constructor would be used. The same is true for the move below.

Something like this would work just fine

MatrixXd m = myfunc1();

no useless copies in case myfunc1 were returning by value.

I double checked once again and the construction of objects via move
assignment is already covered through the constructor. The only thing
which currently not working is

MatrixXd a,b;
a = std::move(b);

Here, b will be still copied. But as I said, the change is trivial. I
have a few unit tests failing

        148 - array_3 (Failed)
        150 - array_5 (Failed)
        394 - geo_transformations_4 (Failed)
        425 - stdvector_overload_1 (Failed)
        426 - stdvector_overload_2 (Failed)
        443 - sparse_basic_1 (Failed)
        444 - sparse_basic_2 (Failed)
        445 - sparse_basic_3 (Failed)
        494 - nullary_5 (Failed)
        543 - sparse_extra_1 (Failed)
        544 - sparse_extra_2 (Failed)
        545 - sparse_extra_3 (Failed)

and will verify in the next days that they are not move or rvalue-ref related.

- Hauke



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