[Numpy-discussion] Getting the indexes of the myarray.min()
Álvaro Tejero Cantero
alvaro at antalia.com
Wed May 12 12:45:07 CDT 2004
Hello,
I am new to numarray. I have been searching the documentation, and see
no evident vectorial and concise way to get the indexes for the minimum
of an array times.min().
Currently my two alternatives are: (times is NxN array)
husband, wife = nonzero(equal(times.min(),times))
#gives tuple of 1x1 arrays, each containing one index
and (even uglier)
husband = compress(times.min()==times,indices([N,N])[0])
wife = compress(times.min()==times,indices([N,N])[1])
These are weird ways to get something as simple. I am surely missing
something, but I have tried several slicing strategies before without
success.
For getting the minimum times in each row I use:
choose(argmin(times),transpose(times))
What are the idioms in numpy for these tasks?
Thank you very much in advance, á.
I would
--
Álvaro Tejero Cantero
http://alqua.org -- documentos libres
free documents
More information about the Numpy-discussion
mailing list