Re: [Numpy-discussion] Find indices of largest elements

2010-04-16 Thread Neal Becker
Nikolaus Rath wrote: > eat writes: >> Nikolaus Rath rath.org> writes: >> >> [snip] >>> Not quite, because I'm interested in the n largest values over all >>> elements, not the largest element in each row or column. But Keith's >>> solution seems to work fine, even though I'm still struggling to

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Nikolaus Rath
eat writes: > Nikolaus Rath rath.org> writes: > > [snip] >> Not quite, because I'm interested in the n largest values over all >> elements, not the largest element in each row or column. But Keith's >> solution seems to work fine, even though I'm still struggling to >> understand what's going on

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Keith Goodman
On Thu, Apr 15, 2010 at 1:48 PM, Keith Goodman wrote: > On Thu, Apr 15, 2010 at 12:41 PM, Nikolaus Rath wrote: >> Keith Goodman writes: >>> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: Keith Goodman writes: > On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman > wrote:

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread eat
Nikolaus Rath rath.org> writes: [snip] > Not quite, because I'm interested in the n largest values over all > elements, not the largest element in each row or column. But Keith's > solution seems to work fine, even though I'm still struggling to > understand what's going on there . My bad. I jus

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Keith Goodman
On Thu, Apr 15, 2010 at 12:41 PM, Nikolaus Rath wrote: > Keith Goodman writes: >> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >>> Keith Goodman writes: On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: >> Hell

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Nikolaus Rath
Keith Goodman writes: > On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >> Keith Goodman writes: >>> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out the indices of the larges

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Nikolaus Rath
eat writes: >> How do I best find out the indices of the largest x elements in an >> array? > > Just > a= np.asarray([[1, 8, 2], [2, 1, 3]]) > print np.where((a.T== a.max(axis= 1)).T) > > However, if any row contains more than 1 max entity, above will fail. Please > let me to know if that's relev

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Charles R Harris
On Wed, Apr 14, 2010 at 4:39 PM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 3:12 PM, Anne Archibald > wrote: > > On 14 April 2010 16:56, Keith Goodman wrote: > >> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath > wrote: > >>> Keith Goodman writes: > On Wed, Apr 14, 2010 at 8:49 AM, K

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 3:12 PM, Anne Archibald wrote: > On 14 April 2010 16:56, Keith Goodman wrote: >> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >>> Keith Goodman writes: On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus R

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Anne Archibald
On 14 April 2010 16:56, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >> Keith Goodman writes: >>> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out th

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread eat
Nikolaus Rath rath.org> writes: > > Hello, > > How do I best find out the indices of the largest x elements in an > array? > > Example: > > a = [ [1,8,2], [2,1,3] ] > magic_function(a, 2) == [ (0,1), (1,2) ] > > Since the largest 2 elements are at positions (0,1) and (1,2). > > Best, > >

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 1:56 PM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >> Keith Goodman writes: >>> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best fi

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: > Keith Goodman writes: >> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: >>> On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: Hello, How do I best find out the indices of the largest x elements in an array?

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Nikolaus Rath
Keith Goodman writes: > On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: >> On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: >>> Hello, >>> >>> How do I best find out the indices of the largest x elements in an >>> array? >>> >>> Example: >>> >>> a = [ [1,8,2], [2,1,3] ] >>> magic_func

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: >> Hello, >> >> How do I best find out the indices of the largest x elements in an >> array? >> >> Example: >> >> a = [ [1,8,2], [2,1,3] ] >> magic_function(a, 2) == [ (0,1), (1,2) ] >> >

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Gökhan Sever
On Wed, Apr 14, 2010 at 10:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out the indices of the largest x elements in an > array? > > Example: > > a = [ [1,8,2], [2,1,3] ] > magic_function(a, 2) == [ (0,1), (1,2) ] > > Since the largest 2 elements are at positions (0,1) and (1,2). >

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out the indices of the largest x elements in an > array? > > Example: > > a = [ [1,8,2], [2,1,3] ] > magic_function(a, 2) == [ (0,1), (1,2) ] > > Since the largest 2 elements are at positions (0,1) and (1,2). He

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Skipper Seabold
On Wed, Apr 14, 2010 at 11:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out the indices of the largest x elements in an > array? > > Example: > > a = [ [1,8,2], [2,1,3] ] > magic_function(a, 2) == [ (0,1), (1,2) ] > > Since the largest 2 elements are at positions (0,1) and (1,2). S

[Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Nikolaus Rath
Hello, How do I best find out the indices of the largest x elements in an array? Example: a = [ [1,8,2], [2,1,3] ] magic_function(a, 2) == [ (0,1), (1,2) ] Since the largest 2 elements are at positions (0,1) and (1,2). Best, -Niko -- »Time flies like an arrow, fruit flies like a Banana