[SciPy-user] sorting arrays with complex numbers

Chris Fonnesbeck fonnesbeck at gmail.com
Mon Sep 12 20:42:42 EDT 2005


This may not be the appropriate place to post this question, but I'm
sure someone has the answer. I am trying to extract the eigenvector
with the largest corresponding eigenvalue from an array of
eigenvectors. As you would expect, the array of eigenvalues contains
complex numbers:

>>> d
array([ 0.6       +0.j        , -0.16037672+0.27778062j,
            -0.16037672-0.27778062j,  0.32075343+0.j        ])

When I try and call max() on this array, I get the following error:

>>> max(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: no ordering relation is defined for complex numbers

What is the appropriate method for extracting the maximum value from this array?

Thanks,
Chris




More information about the SciPy-User mailing list