[Gretl-devel] Re: [Gretl-users] reversing / flipping a matrix

Allin Cottrell cottrell at wfu.edu
Fri Jul 10 10:15:10 EDT 2009


On Fri, 10 Jul 2009, Riccardo (Jack) Lucchetti wrote:

> On Fri, 10 Jul 2009, Sven Schreiber wrote:
> > I agree that two separate functions would not be good. What I meant was
> > something like:
> >
> > rev(A,1)	-- reverses row-wise
> > rev(A,2)	-- reverses col-wise (or maybe rev(A,'c'))
> > rev(A)		-- defaults to /alias for rev(A,1)
>
> This may make sense, with a slight modification: instead of 1/2,
> I'd rather use 0/1, so it becomes easy to decide on a logical
> condition (eg.  rev(A, foo>bar)). Besides, reversing columns
> would probably be more CPU-efficient, since we could use
> memcpy() for that, as in ... [C code snipped]

I agree (and support using the 0/1 flag).  I'm adding the
column-reversal code to CVS for testing (though it looks fine).

One small thing: "rev" strikes me as kinda cryptic.  If it's
standard usage elsewhere then maybe it's OK, but otherwise I'd
prefer something a bit more explicit, say "mreverse".

Allin.


More information about the Gretl-devel mailing list