[Numpy-discussion] k maximal elements

Alex Ter-Sarkissov ater1980@gmail....
Mon Jun 6 01:15:51 CDT 2011


I have a vector of positive integers length n. Is there a simple (i.e.
without sorting/ranking) of 'pulling out' k larrgest (or smallest) values.
Something like

*sum(x[sum(x,1)>(max(sum(x,1)+min(sum(x,1))))/2,])*

but smarter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110606/466f1b52/attachment.html 


More information about the NumPy-Discussion mailing list