> On Mon, Jun 6, 2011 at 6:57 AM, gary ruben <[email protected]> wrote:
> > I learn a lot by watching the numpy and scipy lists (today Olivier
> > taught me about heapq :), but he may not have noticed that Python 2.4
> > added an nsmallest method)

I needed  indices of the selected elements as well (not just the k-smallest 
values themselves) some time ago and compared heapq vs. sort vs. numpy.argsort.

Timing results (for my specific usecase) are at 
https://github.com/piskvorky/gensim/issues/5 . The results are as expected: 
argsort is a must, forming (value, index) tuples explicitly and then sorting 
that with sort/heapq kills performance.

Best,
Radim
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to