Re: [eigen] [PATCH] adding Reverse expression

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


Thanks for your patch; comments below:

2009/2/3 Ricard Marxer Piñón <email@xxxxxxxxxxxxxxxx>:
> Here is a patch to add the Reverse expression this is useful for flipping
> matrices, rows or columns.

I can see that you declare a class Reverse, but don't actually define
it. You probably forgot to "svn add Reverse.h" ?

Your PartialRedux::reverse() method returns a ExpressionType which has
2 drawbacks:
1) it requires ExpressionType to be writable, e.g. one can't use your
reverse() like this,
m3 = (m1+m2).rowwise().reverse();
2) more importantly, your PartialRedux::reverse() is not lazy, so when one does
v2 = v1.reverse();
the arrays are traversed twice: first a temporary vector is created by
reverse(), then this temporary vector is copied into v2.
This is of course inefficient. It is exactly in order to overcome
that, that we introduct expression templates ;)

Cheers,
Benoit



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