Re: [Numpy-discussion] max argmax combo

2006-09-20 Thread Francesc Altet
A Dimarts 19 Setembre 2006 21:41, Bill Baxter va escriure: > 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) I see. Thanks. OTOH, may

Re: [Numpy-discussion] max argmax combo

2006-09-19 Thread Travis Oliphant
Charles R Harris wrote: > > > On 9/18/06, *Bill Baxter* <[EMAIL PROTECTED] > > wrote: > > On 9/19/06, Charles R Harris <[EMAIL PROTECTED] > > wrote: > > On 9/18/06, Bill Baxter <[EMAIL PROTECTED] > > wro

Re: [Numpy-discussion] max argmax combo

2006-09-19 Thread Charles R Harris
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 lik

Re: [Numpy-discussion] max argmax combo

2006-09-19 Thread Bill Baxter
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="indir

Re: [Numpy-discussion] max argmax combo

2006-09-19 Thread Charles R Harris
On 9/19/06, Francesc Altet <[EMAIL PROTECTED]> wrote: A Dimarts 19 Setembre 2006 19:21, Charles R Harris va escriure:> On 9/19/06, Francesc Altet <[EMAIL PROTECTED]> wrote:> > A Dimarts 19 Setembre 2006 07:18, Charles R Harris va escriure: > > > I note that argsort also produces indexes that are ha

Re: [Numpy-discussion] max argmax combo

2006-09-19 Thread Francesc Altet
A Dimarts 19 Setembre 2006 19:21, Charles R Harris va escriure: > On 9/19/06, Francesc Altet <[EMAIL PROTECTED]> 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

Re: [Numpy-discussion] max argmax combo

2006-09-19 Thread Charles R Harris
On 9/19/06, Francesc Altet <[EMAIL PROTECTED]> 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() functio

Re: [Numpy-discussion] max argmax combo

2006-09-19 Thread Francesc Altet
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). H

Re: [Numpy-discussion] max argmax combo

2006-09-18 Thread Charles R Harris
On 9/18/06, Charles R Harris <[EMAIL PROTECTED]> wrote: On 9/18/06, Bill Baxter < [EMAIL PROTECTED]> wrote: On 9/19/06, Charles R Harris <[EMAIL PROTECTED]> wrote:> On 9/18/06, Bill Baxter < [EMAIL PROTECTED]> wrote: > > I find myself often wanting both the max and the argmax of an array.> > (And s

Re: [Numpy-discussion] max argmax combo

2006-09-18 Thread Charles R Harris
On 9/18/06, Bill Baxter <[EMAIL PROTECTED]> wrote: On 9/19/06, Charles R Harris <[EMAIL PROTECTED]> wrote:> On 9/18/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > I find myself often wanting both the max and the argmax of an array.> > (And same for the other arg* functions)> > You have to do someth

Re: [Numpy-discussion] max argmax combo

2006-09-18 Thread Bill Baxter
On 9/19/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > On 9/18/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > I find myself often wanting both the max and the argmax of an array. > > (And same for the other arg* functions) > > You have to do something like > > a = rand(10,5) > > imax =

Re: [Numpy-discussion] max argmax combo

2006-09-18 Thread Charles R Harris
On 9/18/06, Bill Baxter <[EMAIL PROTECTED]> wrote: I find myself often wanting both the max and the argmax of an array.(And same for the other arg* functions)Of course I can do argmax first then use fancy indexing to get the max as well.But the result of argmax isn't really in a format that's readi

[Numpy-discussion] max argmax combo

2006-09-18 Thread Bill Baxter
I find myself often wanting both the max and the argmax of an array. (And same for the other arg* functions) Of course I can do argmax first then use fancy indexing to get the max as well. But the result of argmax isn't really in a format that's readily usable as an index. You have to do something