[Numpy-discussion] numarray: lexicographical sort

Todd Miller jmiller at stsci.edu
Fri Apr 29 12:42:22 EDT 2005


On Fri, 2005-04-29 at 14:30, Edward C. Jones wrote:
> Suppose arr is a two dimensional numarray. Can the following be done 
> entirely within numarray?
>
> alist = arr.tolist()
> alist.sort()
> arr = numarray.array(alist, arr.type())
> 

I'm pretty sure the answer is no.  The comparisons in numarray's sort()
functions are all single element numerical comparisons.  The list sort()
is using a polymorphic comparison which in this case is the comparison
of two lists.  There's nothing like that in numarray so I don't think
it's possible.

Todd






More information about the NumPy-Discussion mailing list