Re: Lexicographical sort for numarray

2005-04-27 Thread Jason Mobarak
Ah, okay, I didn't remember correctly what arr.tolist did. My mistake. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lexicographical sort for numarray

2005-04-27 Thread Robert Kern
Jason Mobarak wrote: It does what the OPs example does, but with numeric types. It certainly does not. In [15]:arr = na.arange(100) In [16]:random.shuffle(arr) In [17]:arr.shape = (10,10) In [18]:arr2 = na.array(arr) In [19]:L = arr.tolist() In [20]:L.sort() In [21]:na.array(L) Out[21]: array([[ 8,

Re: Lexicographical sort for numarray

2005-04-27 Thread Jason Mobarak
It does what the OPs example does, but with numeric types. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lexicographical sort for numarray

2005-04-27 Thread Robert Kern
Jason Mobarak wrote: import numarray as na import random # example array arr = range(100) random.shuffle(arr) arr = na.array(arr) arr = na.reshape(arr, (10,10)) print arr # not rowsort'ed arr.flat.sort() # key line print arr # rowsort'ed That's definitely not a lexicographic sort. -- Robert Kern [E

Re: Lexicographical sort for numarray

2005-04-27 Thread Jason Mobarak
import numarray as na import random # example array arr = range(100) random.shuffle(arr) arr = na.array(arr) arr = na.reshape(arr, (10,10)) print arr # not rowsort'ed arr.flat.sort() # key line print arr # rowsort'ed -- http://mail.python.org/mailman/listinfo/python-list