Karim BELABAS on Sun, 15 Jun 2003 19:08:20 +0200 (MEST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Sorting multi-dimensional vectors


On Sun, 15 Jun 2003, Jon Perry wrote:
> I wish to sort a vector, e.g.
>
> [[1,2],[2,3],[1,3]]
>
> All the inner vectors are the same length, and the order returned should be;
>
> [[1,2],[1,3],[2,3]]
>
> Is there a routine for this, vecsort() doesn't seem to work.

v =  [[1,2],[2,3],[1,3]]
vecsort(v,, 2)   \\ use ascending lexicographic order

    Karim.
-- 
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dép. de Mathématiques, Bât. 425   Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud              http://www.math.u-psud.fr/~belabas/
F-91405 Orsay (France)            http://www.parigp-home.de/  [PARI/GP]