Re: [eigen] Enabled move support for Matrix and Array |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Enabled move support for Matrix and Array
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Tue, 3 May 2011 11:34:47 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=I1iqBQeeociYFa3ZBAowIWo69vO5NuDVtfo0kLeVJ+4=; b=vHdfXAbE6uEgtDdTOF7ay6qI8/ZS9uSffKfOEeQ3H0vwhpT0rghMiKUEB8+uu/Pe5T 0PLsqTkfJbAYqnxA2QTarD6ZZHlrkQXpG7JP3TORfGV7WOybBFydowf70ZqwVMM4SQi/ l1BEAPFpmxELEH/DPGlJ5XQVjGaGBiLJaZjiU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=CYOXPwdf77TIqmmenGILjGDKLrwbtfWftcS1uBb9z3T9s9a2b381Z8u7lMyGC31V9R rWI85GP5O20IYqhwuB7XSYC89EsodrKU8395D/5rmW5FGVK9CnC6bdjnTgDEj4yeF+gd dYVQRUOC0kp3L2jgB3f/7tN2QQWo+pM0S5vnc=
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