[NumPy-Tickets] [NumPy] #1673: first nonzero element

NumPy Trac numpy-tickets@scipy....
Sat Nov 13 11:24:07 CST 2010


#1673: first nonzero element
-------------------------+--------------------------------------------------
 Reporter:  tom3118      |       Owner:  somebody
     Type:  enhancement  |      Status:  new     
 Priority:  normal       |   Milestone:  2.0.0   
Component:  Other        |     Version:  1.5.0   
 Keywords:               |  
-------------------------+--------------------------------------------------
 The "numpy for matlab users" suggests using
 {{{nonzero(A)[0][0]}}}
 to find the index of the first nonzero element of array A.

 The problem with this is that A might be a million elements long and the
 first element might be zero.

 This is an extremely common operation.  An efficient, built-in method for
 this would be very useful.  It also would easy people's transition from
 Matlab in which {{{find}}} is so common.

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


More information about the NumPy-Tickets mailing list