On 9/19/06, Bill Baxter <[EMAIL PROTECTED]> wrote:
On 9/20/06, Francesc Altet <[EMAIL PROTECTED]> wrote:
> A Dimarts 19 Setembre 2006 19:21, Charles R Harris va escriure:
> >
> > 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")
>
> Uh, I don't understand what do you mean by "sort the array using indexes",
> sorry.
>

I think he meant do an argsort first, then use fancy indexing to get
the sorted array.
For a 1-d array that's just

  ind = A.argsort()
  Asorted = A[ind]

That should be O(N lg N + N), aka O(N lg N)
For A >1-d, you need an indexing _expression_ that's a little more
complicated, hence the discussion about making an "extract" function
for that purpose.  Then you could say:

  ind = A.argsort(axis=d)
  Asorted = A.extract(ind,axis=d)

I'm also thinking of the name argtake.

Chuck


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to