sorting arrays with complex numbers
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
Chris Fonnesbeck wrote:
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?
d[argmax(absolute(d))] -- Robert Kern rkern@ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter
participants (2)
-
Chris Fonnesbeck -
Robert Kern