[NumPy-Tickets] [NumPy] #1662: nonzero() requires swap for float types

NumPy Trac numpy-tickets@scipy....
Fri Nov 5 00:46:06 CDT 2010


#1662: nonzero() requires swap for float types
-----------------------+----------------------------------------------------
 Reporter:  m-paradox  |       Owner:  somebody
     Type:  defect     |      Status:  new     
 Priority:  normal     |   Milestone:  2.0.0   
Component:  Other      |     Version:  1.5.0   
 Keywords:             |  
-----------------------+----------------------------------------------------
 The current floating-point nonzero() implementation is incorrect for non-
 native byte order.  Swapping the order should have no effect, but it can
 change the result as visible here:

 {{{
 >>> import numpy as np
 >>> a = np.array([0x80000000, 0x00000080, 0], dtype=np.uint32)
 >>> a.dtype = np.float32
 >>> print a.nonzero()
 (array([1]),)
 >>> print a.byteswap().newbyteorder().nonzero()
 (array([0]),)
 }}}

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


More information about the NumPy-Tickets mailing list