Re: [Numpy-discussion] argsort speed

2014-02-24 Thread Ondřej Čertík
On Fri, Feb 21, 2014 at 11:09 PM, Charles R Harris wrote: > > > > On Fri, Feb 21, 2014 at 10:35 PM, Ondřej Čertík > wrote: >> >> On Mon, Feb 17, 2014 at 11:40 AM, Charles R Harris >> wrote: >> > >> > >> > >> > On Mon, Feb 17, 2014 at 11:32 AM, Julian Taylor >> > wrote: >> >> >> >> On 17.02.2014

Re: [Numpy-discussion] argsort speed

2014-02-21 Thread Charles R Harris
On Fri, Feb 21, 2014 at 10:35 PM, Ondřej Čertík wrote: > On Mon, Feb 17, 2014 at 11:40 AM, Charles R Harris > wrote: > > > > > > > > On Mon, Feb 17, 2014 at 11:32 AM, Julian Taylor > > wrote: > >> > >> On 17.02.2014 15:18, Francesc Alted wrote: > >> > On 2/17/14, 1:08 AM, josef.p...@gmail.com wr

Re: [Numpy-discussion] argsort speed

2014-02-21 Thread Ondřej Čertík
On Mon, Feb 17, 2014 at 11:40 AM, Charles R Harris wrote: > > > > On Mon, Feb 17, 2014 at 11:32 AM, Julian Taylor > wrote: >> >> On 17.02.2014 15:18, Francesc Alted wrote: >> > On 2/17/14, 1:08 AM, josef.p...@gmail.com wrote: >> >> On Sun, Feb 16, 2014 at 6:12 PM, Daπid wrote: >> >>> On 16 Febru

Re: [Numpy-discussion] argsort speed

2014-02-17 Thread Charles R Harris
On Mon, Feb 17, 2014 at 11:32 AM, Julian Taylor < jtaylor.deb...@googlemail.com> wrote: > On 17.02.2014 15:18, Francesc Alted wrote: > > On 2/17/14, 1:08 AM, josef.p...@gmail.com wrote: > >> On Sun, Feb 16, 2014 at 6:12 PM, Daπid wrote: > >>> On 16 February 2014 23:43, wrote: > What's the f

Re: [Numpy-discussion] argsort speed

2014-02-17 Thread Julian Taylor
On 17.02.2014 15:18, Francesc Alted wrote: > On 2/17/14, 1:08 AM, josef.p...@gmail.com wrote: >> On Sun, Feb 16, 2014 at 6:12 PM, Daπid wrote: >>> On 16 February 2014 23:43, wrote: What's the fastest argsort for a 1d array with around 28 Million elements, roughly uniformly distributed,

Re: [Numpy-discussion] argsort speed

2014-02-17 Thread josef . pktd
On Mon, Feb 17, 2014 at 9:18 AM, Francesc Alted wrote: > On 2/17/14, 1:08 AM, josef.p...@gmail.com wrote: >> On Sun, Feb 16, 2014 at 6:12 PM, Daπid wrote: >>> On 16 February 2014 23:43, wrote: What's the fastest argsort for a 1d array with around 28 Million elements, roughly uniformly

Re: [Numpy-discussion] argsort speed

2014-02-17 Thread Francesc Alted
On 2/17/14, 1:08 AM, josef.p...@gmail.com wrote: > On Sun, Feb 16, 2014 at 6:12 PM, Daπid wrote: >> On 16 February 2014 23:43, wrote: >>> What's the fastest argsort for a 1d array with around 28 Million >>> elements, roughly uniformly distributed, random order? >> >> On numpy latest version: >> >

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread Charles R Harris
On Sun, Feb 16, 2014 at 4:12 PM, Daπid wrote: > On 16 February 2014 23:43, wrote: > >> What's the fastest argsort for a 1d array with around 28 Million >> elements, roughly uniformly distributed, random order? >> > > On numpy latest version: > > for kind in ['quicksort', 'mergesort', 'heapsort']

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread josef . pktd
>> the >> >> argsort is continuously making completely random memory accesses. >> >> >> >> >> >> -Original Message- >> >> From: josef.p...@gmail.com >> >> Sent: Sunday, February 16, 2014 11:43 PM >> >>

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread Charles R Harris
sage- > >> From: josef.p...@gmail.com > >> Sent: Sunday, February 16, 2014 11:43 PM > >> To: Discussion of Numerical Python > >> Subject: [Numpy-discussion] argsort speed > >> > >> currently using numpy 1.6.1 > >> > >> What&#

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread josef . pktd
On Sun, Feb 16, 2014 at 6:12 PM, Daπid wrote: > On 16 February 2014 23:43, wrote: >> >> What's the fastest argsort for a 1d array with around 28 Million >> elements, roughly uniformly distributed, random order? > > > On numpy latest version: > > for kind in ['quicksort', 'mergesort', 'heapsort']:

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread josef . pktd
nplace sort gains locality as it is being sorted, whereas the >> argsort is continuously making completely random memory accesses. >> >> >> -Original Message- >> From: josef.p...@gmail.com >> Sent: Sunday, February 16, 2014 11:43 PM >> To: Discussion of

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread josef . pktd
uously making completely random memory accesses. > > > -Original Message- > From: josef.p...@gmail.com > Sent: Sunday, February 16, 2014 11:43 PM > To: Discussion of Numerical Python > Subject: [Numpy-discussion] argsort speed > > currently using numpy 1.6.1 > &

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread Daπid
On 17 February 2014 00:12, Daπid wrote: > I seem unable to find the code for ndarray.sort, so I can't check. I have > tried to grep it tring all possible combinations of "def ndarray", > "self.sort", etc. Where is it? Nevermind, it is in core/src/multiarray/methods.c __

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread Daπid
On 16 February 2014 23:43, wrote: > What's the fastest argsort for a 1d array with around 28 Million > elements, roughly uniformly distributed, random order? > On numpy latest version: for kind in ['quicksort', 'mergesort', 'heapsort']: print kind %timeit np.sort(data, kind=kind) %t

Re: [Numpy-discussion] argsort speed

2014-02-16 Thread Eelco Hoogendoorn
...@gmail.com Sent: Sunday, February 16, 2014 11:43 PM To: Discussion of Numerical Python Subject: [Numpy-discussion] argsort speed currently using numpy 1.6.1 What's the fastest argsort for a 1d array with around 28 Million elements, roughly uniformly distributed, random order? Is there a r

[Numpy-discussion] argsort speed

2014-02-16 Thread josef . pktd
currently using numpy 1.6.1 What's the fastest argsort for a 1d array with around 28 Million elements, roughly uniformly distributed, random order? Is there a reason that np.argsort is almost 3 times slower than np.sort? I'm doing semi-systematic timing for a stats(models) algorithm. Josef

Re: [Numpy-discussion] argsort

2013-01-16 Thread Robert Kern
On Wed, Jan 16, 2013 at 9:30 AM, Mads Ipsen wrote: > Hi, > > Thanks everybody for all the answers that make perfect sense when axis=0. > > Now suppose I want to sort the array in such a way that each row is sorted > individually. Then I suppose I should do this: > > from numpy import * > > > v = a

Re: [Numpy-discussion] argsort

2013-01-16 Thread Mads Ipsen
Hi, Thanks everybody for all the answers that make perfect sense when axis=0. Now suppose I want to sort the array in such a way that each row is sorted individually. Then I suppose I should do this: from numpy import * v = array([[4,3], [1,12], [23,7], [11,6

Re: [Numpy-discussion] argsort

2013-01-15 Thread eat
Hi, On Tue, Jan 15, 2013 at 1:50 PM, Mads Ipsen wrote: > Hi, > > I simply can't understand this. I'm trying to use argsort to produce > indices that can be used to sort an array: > > from numpy import * > > indices = array([[4,3],[1,12],[23,7],[11,6],[8,9]]) > args = argsort(indices, axis

Re: [Numpy-discussion] argsort

2013-01-15 Thread Robert Kern
On Tue, Jan 15, 2013 at 3:44 PM, Charles R Harris wrote: > Fancy indexing is a funny creature and not easy to understand in more than > one dimension. What is happening is that each index is replaced by the > corresponding row of a and the result is of shape (5,2,2). To do what you > want to do: >

Re: [Numpy-discussion] argsort

2013-01-15 Thread Charles R Harris
On Tue, Jan 15, 2013 at 4:50 AM, Mads Ipsen wrote: > Hi, > > I simply can't understand this. I'm trying to use argsort to produce > indices that can be used to sort an array: > > from numpy import * > > indices = array([[4,3],[1,12],[23,7],[11,6],[8,9]]) > args = argsort(indices, axis=0) >

[Numpy-discussion] argsort

2013-01-15 Thread Mads Ipsen
Hi, I simply can't understand this. I'm trying to use argsort to produce indices that can be used to sort an array: from numpy import * indices = array([[4,3],[1,12],[23,7],[11,6],[8,9]]) args = argsort(indices, axis=0) print indices[args] gives: [[[ 1 12] [ 4 3]] [[ 4 3] [1

Re: [Numpy-discussion] Argsort

2009-02-05 Thread Robert Kern
On Thu, Feb 5, 2009 at 17:06, Ryan May wrote: > Hi, > > Ok, what am I missing here: > > x = np.array([[4,2],[5,3]]) > x[x.argsort(1)] > > array([[[5, 3], >[4, 2]], > > [[5, 3], >[4, 2]]]) > > I was expecting: > > array([[2,4],[3,5]]) > > Certainly not a 3D array. What am I d

[Numpy-discussion] Argsort

2009-02-05 Thread Ryan May
Hi, Ok, what am I missing here: x = np.array([[4,2],[5,3]]) x[x.argsort(1)] array([[[5, 3], [4, 2]], [[5, 3], [4, 2]]]) I was expecting: array([[2,4],[3,5]]) Certainly not a 3D array. What am I doing wrong? Ryan -- Ryan May Graduate Research Assistant School of Met

Re: [Numpy-discussion] argsort in descending order

2008-09-05 Thread Dan Lenski
On Fri, 05 Sep 2008 07:02:38 -0700, SimonPalmer wrote: > another newb question I suspect, but is there a way to instruct argsort > to sort in descending order or should I just sort and reverse? Just sort and subtract to get the reverse order. I can think of two reasonable ways to do it with no

Re: [Numpy-discussion] argsort in descending order

2008-09-05 Thread Charles R Harris
On Fri, Sep 5, 2008 at 8:02 AM, SimonPalmer <[EMAIL PROTECTED]> wrote: > another newb question I suspect, but is there a way to instruct > argsort to sort in descending order or should I just sort and reverse? You'll just have to reverse the indices. Chuck __

[Numpy-discussion] argsort in descending order

2008-09-05 Thread SimonPalmer
another newb question I suspect, but is there a way to instruct argsort to sort in descending order or should I just sort and reverse? ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] argsort memory problem?

2008-01-30 Thread Oriol Vendrell
* Robin <[EMAIL PROTECTED]> [2008-01-29 19:23:11 +]: > On Jan 29, 2008 7:16 PM, Lou Pecora <[EMAIL PROTECTED]> wrote: > > Hmmm... Interesting. I am using Python 2.4.4. It > > would be nice to have other Mac people with same/other > > Python and numpy versions try the argsort "bug" code. > >

Re: [Numpy-discussion] argsort memory problem?

2008-01-29 Thread Robin
On Jan 29, 2008 7:16 PM, Lou Pecora <[EMAIL PROTECTED]> wrote: > Hmmm... Interesting. I am using Python 2.4.4. It > would be nice to have other Mac people with same/other > Python and numpy versions try the argsort "bug" code. I don't see any memory leak with the test code. Mac OS X 10.5.1 Pytho

Re: [Numpy-discussion] argsort memory problem?

2008-01-29 Thread Lou Pecora
Hmmm... Interesting. I am using Python 2.4.4. It would be nice to have other Mac people with same/other Python and numpy versions try the argsort "bug" code. -- Lou Pecora --- Francesc Altet <[EMAIL PROTECTED]> wrote: > A Tuesday 29 January 2008, Lou Pecora escrigué: > > This still occurs in

Re: [Numpy-discussion] argsort memory problem?

2008-01-29 Thread Francesc Altet
A Tuesday 29 January 2008, Lou Pecora escrigué: > This still occurs in numpy 1.0.3.1 so must have been > fixed between that and your 1.0.4-5 version. It works here and I'm using NumPy 1.0.3, Python 2.5.1 on a Ubuntu 7.10 / Pentium4 machine. > By the way the memory problem crashes my Intel Mac >

Re: [Numpy-discussion] argsort memory problem?

2008-01-29 Thread Lou Pecora
This still occurs in numpy 1.0.3.1 so must have been fixed between that and your 1.0.4-5 version. By the way the memory problem crashes my Intel Mac Book Pro (system 10.4.11) with the gray screen and black dialog box telling me to restart my computer. A very UN-unix like and UN-Mac like way of

Re: [Numpy-discussion] argsort memory problem?

2008-01-29 Thread Alexandre Fayolle
On Tue, Jan 29, 2008 at 02:58:15PM +0100, Oriol Vendrell wrote: > Hi all, > > I've noticed something that looks like an odd behaviour in array.argsort(). > > > # test1 - > from numpy import array > while True: > a=array([8.0,7.0,6.0,5.0,4.0,2.0]) > i=a.argsort() > # -

[Numpy-discussion] argsort memory problem?

2008-01-29 Thread Oriol Vendrell
Hi all, I've noticed something that looks like an odd behaviour in array.argsort(). # test1 - from numpy import array while True: a=array([8.0,7.0,6.0,5.0,4.0,2.0]) i=a.argsort() # --- # test2 - from numpy import array a=ar

Re: [Numpy-discussion] argsort and take along arbitrary axes

2007-05-14 Thread Charles R Harris
On 5/14/07, Zachary Pincus <[EMAIL PROTECTED]> wrote: >> I've got a few questions that came up as I tried to calculate various >> statistics about an image time-series. For example, I have an array >> of shape (t,x,y) representing t frames of a time-lapse of resolution >> (x,y). >> >> Now, say I

Re: [Numpy-discussion] argsort and take along arbitrary axes

2007-05-14 Thread Zachary Pincus
>> I've got a few questions that came up as I tried to calculate various >> statistics about an image time-series. For example, I have an array >> of shape (t,x,y) representing t frames of a time-lapse of resolution >> (x,y). >> >> Now, say I want to both argsort and sort this time-series, pixel- >

Re: [Numpy-discussion] argsort and take along arbitrary axes

2007-05-14 Thread Charles R Harris
On 5/13/07, Zachary Pincus <[EMAIL PROTECTED]> wrote: Hello all, I've got a few questions that came up as I tried to calculate various statistics about an image time-series. For example, I have an array of shape (t,x,y) representing t frames of a time-lapse of resolution (x,y). Now, say I want

[Numpy-discussion] argsort and take along arbitrary axes

2007-05-14 Thread Zachary Pincus
Hello all, I've got a few questions that came up as I tried to calculate various statistics about an image time-series. For example, I have an array of shape (t,x,y) representing t frames of a time-lapse of resolution (x,y). Now, say I want to both argsort and sort this time-series, pixel-