[Numpy-discussion] k maximal elements

Alex Ter-Sarkissov ater1980 at gmail.com
Mon Jun 6 02:15:51 EDT 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.python.org/pipermail/numpy-discussion/attachments/20110606/466f1b52/attachment.html>


More information about the NumPy-Discussion mailing list