Re: [Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-16 Thread Nathaniel Smith
On Tue, May 15, 2012 at 5:03 AM, Travis Oliphant wrote: > So, the behavior is actually quite predictable, it's just that in some common > cases it doesn't do what you would expect --- especially if you think that > [0,1] is "the same" as :2.   When I wrote this code to begin with I should > hav

Re: [Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-15 Thread Eric Firing
On 05/14/2012 06:03 PM, Travis Oliphant wrote: > What happens, though when you have > > a[:, in1 :, in2]? > > in1 and in2 are broadcasted together to create a two-dimensional > "sub-space" that must fit somewhere. Where should it go? Should > it replace in1 or in2?I.e. should the output be

Re: [Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-15 Thread Stéfan van der Walt
On Mon, May 14, 2012 at 9:03 PM, Travis Oliphant wrote: > What happens, though when you have > > a[:, in1 :, in2]? > [...] > > To "resolve" this ambiguity, the code sends the (3,4) sub-space to the front > of the "dimensions" and returns (3,4,10,8).   In retro-spect, the code should > raise an e

Re: [Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-15 Thread Olivier Delalleau
2012/5/15 Travis Oliphant > > On May 14, 2012, at 7:07 PM, Stéfan van der Walt wrote: > > > Hi Zach > > > > On Mon, May 14, 2012 at 4:33 PM, Zachary Pincus > wrote: > >> The below seems to be a bug, but perhaps it's unavoidably part of the > indexing mechanism? > >> > >> It's easiest to show via

Re: [Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-14 Thread Travis Oliphant
On May 14, 2012, at 7:07 PM, Stéfan van der Walt wrote: > Hi Zach > > On Mon, May 14, 2012 at 4:33 PM, Zachary Pincus > wrote: >> The below seems to be a bug, but perhaps it's unavoidably part of the >> indexing mechanism? >> >> It's easiest to show via example... note that using "[0,1]" to

Re: [Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-14 Thread Zachary Pincus
> On Mon, May 14, 2012 at 4:33 PM, Zachary Pincus > wrote: >> The below seems to be a bug, but perhaps it's unavoidably part of the >> indexing mechanism? >> >> It's easiest to show via example... note that using "[0,1]" to pull two >> columns out of the array gives the same shape as using ":2

Re: [Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-14 Thread Stéfan van der Walt
Hi Zach On Mon, May 14, 2012 at 4:33 PM, Zachary Pincus wrote: > The below seems to be a bug, but perhaps it's unavoidably part of the > indexing mechanism? > > It's easiest to show via example... note that using "[0,1]" to pull two > columns out of the array gives the same shape as using ":2"

[Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-14 Thread Zachary Pincus
Hello all, The below seems to be a bug, but perhaps it's unavoidably part of the indexing mechanism? It's easiest to show via example... note that using "[0,1]" to pull two columns out of the array gives the same shape as using ":2" in the simple case, but when there's additional slicing happe