You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there!
If you have and array with complex values, and try to execute: numpy.amax(array), amax, brings a result the max number of the array, but it only search in the real part.
I think that there shouldn't be result, like it happens when you call the max methods on a simple list.
In [1]: import numpy as np
In [2]: a_list = [1+2j, 1+3j, 2+2j,1+100j, 5+1j]
In [3]: a_np = np.array([1+2j, 1+3j, 2+2j,1+100j, 5+1j])
In [4]: np.amax(a_np)
Out[4]: (5+1j)
In [5]: max(a_list)
TypeError Traceback (most recent call last)
/home/malev/ in ()
TypeError: no ordering relation is defined for complex numbers
The code here: http://pastebin.com/b8JgMNhm
finally, I'm using:
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
and numpy: '1.3.0'
Regards
malev
The text was updated successfully, but these errors were encountered:
Numpy defines an lexicographical ordering (sort by real part first, then by imaginary part) for complex numbers, so the behavior of amax is in line with that.
Changing that at this point requires a heavy reason to do so.
Original ticket http://projects.scipy.org/numpy/ticket/1406 on 2010-02-23 by trac user malev, assigned to unknown.
Hi there!
If you have and array with complex values, and try to execute: numpy.amax(array), amax, brings a result the max number of the array, but it only search in the real part.
I think that there shouldn't be result, like it happens when you call the max methods on a simple list.
In [1]: import numpy as np
In [2]: a_list = [1+2j, 1+3j, 2+2j,1+100j, 5+1j]
In [3]: a_np = np.array([1+2j, 1+3j, 2+2j,1+100j, 5+1j])
In [4]: np.amax(a_np)
Out[4]: (5+1j)
In [5]: max(a_list)
TypeError Traceback (most recent call last)
/home/malev/ in ()
TypeError: no ordering relation is defined for complex numbers
The code here: http://pastebin.com/b8JgMNhm
finally, I'm using:
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
and numpy: '1.3.0'
Regards
malev
The text was updated successfully, but these errors were encountered: