[Gretl-users] reversing / flipping a matrix

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Fri Jul 10 05:57:06 EDT 2009

On Fri, 10 Jul 2009, Sven Schreiber wrote:

> Dear gretl users,
> yesterday I needed to flip a matrix/vector around by reversing the order
> of the elements. (I guess like rev() or flipud() in other languages.)
> But I didn't find the function to do that, so I used an inefficient
> workaround using msortby(). But since this seems like quite basic
> functionality I think I either missed something or it should be added,
> right?

Right. I must have said to myself "I need to do this. Oh well, not now" a 
thousand times. It's now in CVS. The user-level function is called rev(). 

? A = rev(I(3))
  A = rev(I(3))
Generated matrix A
? print A
  print A
A (3 x 3)

   0   0   1
   0   1   0
   1   0   0

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti at univpm.it

More information about the Gretl-users mailing list