From: T. C. <al...@an...> - 2004-05-12 21:22:09
|
Hello, > To find the index of ONE minimum value is easy,=20 > though it is buried in the nd_image sub-package=20 > (where many users might miss it): > numarray.nd_image.minimum_position It works great... but what about efficiency? If I do times.min() and then numarray.nd_image.minimum_positioan(times) I am running twice essentially the same extremum-finding routine, which is prohibitibe for large N..., am I right? Which makes me thing of a more general question: I know that some of the array functions are coded in C for speed, but what about the classical python-for loop, as in (r Nx3 array of particle positions) [ [r[i]-r[j] for i in arange(N)] for j in arange(N)] is this handled to C code? > I do not know a clean way to find all locations=20 > of the minimum value. I hope somebody else does. Yes... although for the problem at hand that motivated my query, my times matrix is symmetric... I don't really need all the minima, but does numarray have any special datatype for symmetric matrixes, that prevents storage of unneded (e.g. supradiagonal) elements?. Thank you very much, I'm on my way to get some beautiful code out of old fortranisms=20 =E1. --=20 =C1lvaro Tejero Cantero http://alqua.org -- documentos libres free documents |