[Numpy-discussion] Find the N maximum values and corresponding indexes in an array

Neal Becker ndbecker2 at gmail.com
Wed Dec 2 20:27:53 EST 2009


Keith Goodman wrote:

...
>> Not bad, although I wonder whether a partial sort could be faster.
> 
> I'm doing a lot of sorting right now. I only need to sort the lowest
> 30% of values in a 1d array (about 250k elements), the rest I don't
> need to sort. How do I do a partial sort?

I only know of it because of the standard c++ library std::partial_sort
That should give references (maybe heap-based?)




More information about the NumPy-Discussion mailing list