From: T. C. <al...@an...> - 2004-05-12 19:44:59
|
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 =3D nonzero(equal(times.min(),times))=20 #gives tuple of 1x1 arrays, each containing one index and (even uglier) husband =3D compress(times.min()=3D=3Dtimes,indices([N,N])[0]) wife =3D compress(times.min()=3D=3Dtimes,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, =E1. I would=20 --=20 =C1lvaro Tejero Cantero http://alqua.org -- documentos libres free documents |