On Fri, 10 Jul 2009, Riccardo (Jack) Lucchetti wrote:
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().
Example:
? 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
Oh, sorry, I should have said: the rev() function reverses the order of
the _rows_ of the matrix (from the example above, it could have been the
columns).
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti