Re: [eigen] [PATCH] adding Reverse expression

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


Hi,

some tips:
- to get the colwise/rowwise working correctly, I'd add a "int
Direction" template parameter to Reverse
- the name of the PartialRedux class is correct anymore and we should
find something else (DirectionalOperator, DirectionalWise, ???)
- the stride and nonZero overloads are not needed
- for the vectorization you need a ei_preverse() function, I guess I
can add it myself.
- it would be nice to add a unit test.

gael.

On Tue, Feb 3, 2009 at 1:41 AM, Ricard Marxer Piñón
<email@xxxxxxxxxxxxxxxx> wrote:
>
>
> On Tue, Feb 3, 2009 at 12:50 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
> wrote:
>>
>> 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" ?
>
> ups yep.  I  had some trouble because I still had all the Toeplitz stuff and
> was trying to isolate the reverse stuff (aaah I wish I could get git svn to
> work)
> Anyway here is the full diff.
>
>>
>> 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 ;)
>
> Yes the PartialRedux reverse is very drafty, I just wanted the API to be as
> I wanted it to be.  I will try to get it right with a bit more work.
>
>>
>> Cheers,
>> Benoit
>>
>>
>
>
>
> --
> ricard
> http://www.ricardmarxer.com
> http://www.caligraft.com
>



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