Re: [Numpy-discussion] Strange behavior for argsort() and take()

2008-06-19 Thread Anne Archibald
2008/6/18 Charles R Harris <[EMAIL PROTECTED]>: > > > On Wed, Jun 18, 2008 at 11:48 AM, Anne Archibald <[EMAIL PROTECTED]> > wrote: >> >> 2008/6/18 Stéfan van der Walt <[EMAIL PROTECTED]>: >> > 2008/6/18 Anne Archibald <[EMAIL PROTECTED]>: >> >> In [7]: x.take(x.argsort()) >> >> Out[7]: array([ 0.

Re: [Numpy-discussion] Strange behavior for argsort() and take()

2008-06-18 Thread Charles R Harris
On Wed, Jun 18, 2008 at 11:48 AM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/6/18 Stéfan van der Walt <[EMAIL PROTECTED]>: > > 2008/6/18 Anne Archibald <[EMAIL PROTECTED]>: > >> In [7]: x.take(x.argsort()) > >> Out[7]: array([ 0. , 0.1, 0.2, 0.3]) > >> > >> If you would like to think of i

Re: [Numpy-discussion] Strange behavior for argsort() and take()

2008-06-18 Thread Anne Archibald
2008/6/18 Stéfan van der Walt <[EMAIL PROTECTED]>: > 2008/6/18 Anne Archibald <[EMAIL PROTECTED]>: >> In [7]: x.take(x.argsort()) >> Out[7]: array([ 0. , 0.1, 0.2, 0.3]) >> >> If you would like to think of it more mathematically, when you feed >> np.argsort() an array that represents a permutati

Re: [Numpy-discussion] Strange behavior for argsort() and take()

2008-06-18 Thread Charles R Harris
On Wed, Jun 18, 2008 at 10:53 AM, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > 2008/6/18 Anne Archibald <[EMAIL PROTECTED]>: > > In [7]: x.take(x.argsort()) > > Out[7]: array([ 0. , 0.1, 0.2, 0.3]) > > > > If you would like to think of it more mathematically, when you feed > > np.argsort()

Re: [Numpy-discussion] Strange behavior for argsort() and take()

2008-06-18 Thread Thomas J. Duck
Thanks, Anne. I misinterpreted what argsort() provides. I was thinking about it in terms of the kind of behaviour exhibited by searchsorted(). --Tom -- On 18-Jun-08, at 12:10 PM, Anne Archibald wrote: > 2008/6/18 Thomas J. Duck <[EMAIL PROTECTED]>: > >> I have found what I

Re: [Numpy-discussion] Strange behavior for argsort() and take()

2008-06-18 Thread Stéfan van der Walt
2008/6/18 Anne Archibald <[EMAIL PROTECTED]>: > In [7]: x.take(x.argsort()) > Out[7]: array([ 0. , 0.1, 0.2, 0.3]) > > If you would like to think of it more mathematically, when you feed > np.argsort() an array that represents a permutation of the numbers > 0,1,...,n-1, you get back the inverse

Re: [Numpy-discussion] Strange behavior for argsort() and take()

2008-06-18 Thread Anne Archibald
2008/6/18 Thomas J. Duck <[EMAIL PROTECTED]>: > I have found what I think is some strange behavior for argsort > () and take(). First, here is an example that works as expected: > > >>> x = numpy.array([1,0,3,2]) > >>> x.argsort() > array([1, 0, 3, 2]) > > argsort() returns th

[Numpy-discussion] Strange behavior for argsort() and take()

2008-06-18 Thread Thomas J. Duck
Hi, I have found what I think is some strange behavior for argsort () and take(). First, here is an example that works as expected: >>> x = numpy.array([1,0,3,2]) >>> x.argsort() array([1, 0, 3, 2]) argsort() returns the original array, which is self-indexing for numb