[NumPy-Tickets] [NumPy] #1406: [amax()] bad behaviour with complex arrays

NumPy Trac numpy-tickets@scipy....
Tue Feb 23 13:55:31 CST 2010

#1406: [amax()] bad behaviour with complex arrays
 Reporter:  malev                   |       Owner:  somebody
     Type:  defect                  |      Status:  new     
 Priority:  normal                  |   Milestone:          
Component:  Other                   |     Version:  1.3.0   
 Keywords:  numpy, complex numbers  |  
 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/<ipython console> in <module>()
 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'


Ticket URL: <http://projects.scipy.org/numpy/ticket/1406>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list