You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bottl...@googlegroups.com
Hi! Need to part sort so that it returns top R and bottom R results. Obvious solution is to bottleneck.argpartsort for top R followed by bottleneck.argpartsort for bottom R. Is there a more efficient alternative?
Keith Goodman
unread,
Jun 25, 2013, 12:30:42 PM6/25/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
Hi! Need to part sort so that it returns top R and bottom R results. Obvious solution is to bottleneck.argpartsort for top R followed by bottleneck.argpartsort for bottom R. Is there a more efficient alternative?
It might depend on the sizes involved. If 2R == N then one partsort is all you need! If R << N then it will be hard to do a lot better than two sorts.
bn.partsort is probably a little faster than bn.argpartsort if you only need the values and not the indices. And if you use bn.partsort then you can use a slice of the sorted array a[R:] for the second sort. That should save some time if R is a decent fraction of N.
ipython's timeit will give you the answer. If you try a few methods then share the results with us.
dbv
unread,
Jun 26, 2013, 3:25:27 AM6/26/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bottl...@googlegroups.com
Uhmm. Indices are needed plus R, N are variable. Looks like two sorts will be needed.