Re: [eigen] aliasing system

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


Benoît Jacob wrote:
Hi,

today I've added the aliasing system and remove operator<<, so the tutorial in my previous e-mail does no longer work, I attach a new version of the tutorial.

What is the aliasing system? It enables the creation of a temporary object. Expression templates remove temporaries, which is generally very good for performance, but sometimes the temporary was really needed and its removal causes problems.

For instance, when you do (for a matrix m)
	m = m * m;

wow. this gives me some headache. in my opinion the above expression must work, because many users with no idea about expression templates will easily write such code, and that very often. expression templates should be no excuse. is there no way to fix it in a nicer way, besides that .alias function?

is there any chance to get the above expression working ? without that .alias() trick ?

maybe thats a stupid question, but cant the .alias() thing be integrated in an operator=(const Matrix<T,d1,d2>&m) { this->alias()=m; } ??



it gives m a wrong value, in Eigen2 like in every other ET-enabled library. To correct that, do:
        m.alias() = m * m;
Now our aliasing system is really powerful in that it is fully compatible with ETs. So you can do
        m.alias().xpr().block(1,3,1,3) = m.block(0,2,0,2)
to safely copy between overlapping blocks of a matrix.

Cheers,
Benoit





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