[Numpy-discussion] max argmax combo

Charles R Harris charlesr.harris at gmail.com
Tue Sep 19 12:21:19 CDT 2006


On 9/19/06, Francesc Altet <faltet at carabos.com> wrote:
>
> A Dimarts 19 Setembre 2006 07:18, Charles R Harris va escriure:
> > I note that argsort also produces indexes that are hard to use in the
> > ndim>1 case.
>
> Perhaps it is worth to mention here that I've always liked to have a
> sort()
> and argsort() functionality merged in one shot function (or method).
> Having
> both separated implies two sorts, while if I'd have such a combo
> available,
> the resulting operation would take quite less time.


Do you want both the indexes and index sorted array returned, or just sort
the array using indexes, i.e., something like

a.sort(kind="quicksort", method="indirect")

IIRC, the old numeric argsort actually did something like this under the
covers but discarded the sorted array.

One can easily stablish kind of a pattern for situations where this could
> happen: in all the 'arg*()' functions. Perhaps I'm wrong in my count, but
> there appear to be only three of such functions in NumPy, namely, argmax,
> argmin and argsort. Adding three additional 'combos' doesn't seem a lot to
> my
> mind, but it can be just 'too much' for more common sense minds.


Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060919/83998a54/attachment.html 


More information about the Numpy-discussion mailing list