[Numpy-discussion] sort bug

Anton Sherwood anton.sherwood at gmail.com
Thu Apr 26 14:30:15 EDT 2007


Travis Oliphant wrote:
> cmp(x,y) must return -1, 0, or 1 which doesn't work on arrays with more
> than 1 element because it is ambiguous.  Thus you get this error.

Ah.  Since lists *can* be compared, I assumed arrays would inherit
that property.

> The operation is undefined.  What do you actually want to do when you
> have equal-valued eigenvalues?

Don't care.

All I really need is the four highest eigenvalues and their vectors.
I'll have a look in "Python Cookbook" to see if there's a more
efficient way to do that partial sort.

-- 
Anton Sherwood, http://www.ogre.nu/



More information about the NumPy-Discussion mailing list