Re: [Numpy-discussion] Is this an indexing bug?

2007-06-20 Thread Sturla Molden
> These are both correct. See my previous posts about the rule. > > The first case is exactly the example we saw before: we start with a > (1,10,10)-shaped array and replace the first and last-dimension > (1,10)-shaped array with a (5,)-shaped array. Not having a clear place > to put the extrac

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-20 Thread Sven Schreiber
Travis Oliphant schrieb: > Sturla Molden wrote: >> >>> x = numpy.arange(100).reshape((1,10,10)) >> >> >>> x[0,:,numpy.arange(5)].shape >> (5, 10) >> >> >>> x[:,:,numpy.arange(5)].shape >> (1, 10, 5) >> >> >> It looks like a bug that needs to be squashed. >> > > These are both correct. See m

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-20 Thread Travis Oliphant
Sturla Molden wrote: > >>> x = numpy.arange(100).reshape((1,10,10)) > > >>> x[0,:,numpy.arange(5)].shape > (5, 10) > > >>> x[:,:,numpy.arange(5)].shape > (1, 10, 5) > > > It looks like a bug that needs to be squashed. > These are both correct. See my previous posts about the rule. The firs

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-20 Thread Travis Oliphant
Sturla Molden wrote: > On 6/19/2007 12:19 PM, Sven Schreiber wrote: > > >> To be more specific, I would expect shape==(4,14). >> > > > >>> h = numpy.zeros((1,4,14)) > >>> h[0,:,numpy.arange(14)].shape > (14, 4) > >>> h[0,:,:].shape > (4, 14) > >>> > > > h[0,:,numpy.arange(14)] is a case

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-20 Thread Travis Oliphant
Stefan van der Walt wrote: > On Tue, Jun 19, 2007 at 12:35:05PM +0200, Sturla Molden wrote: > >> On 6/19/2007 12:14 PM, Sturla Molden wrote: >> >> >>> h[0,:,numpy.arange(14)] is a case of "sdvanced indexing". You can also >>> see that >>> >>> >>> h[0,:,[0,1,2,3,4,5,6,7,8,9,10,11,12,13]].s

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Sven Schreiber
Sturla Molden schrieb: > > >>> x = numpy.arange(100).reshape((1,10,10)) > > >>> x[0,:,numpy.arange(5)].shape > (5, 10) > > >>> x[:,:,numpy.arange(5)].shape > (1, 10, 5) > > > It looks like a bug that needs to be squashed. > > S.M. And you already had me convinced ;-) I'm still curious wh

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Sturla Molden
>>> x = numpy.arange(100).reshape((1,10,10)) >>> x[0,:,numpy.arange(5)].shape (5, 10) >>> x[:,:,numpy.arange(5)].shape (1, 10, 5) It looks like a bug that needs to be squashed. S.M. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org ht

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Sturla Molden
On 6/19/2007 1:28 PM, Stefan van der Walt wrote: > > x = N.arange(100).reshape((10,10)) > x[:,N.arange(5)].shape > > should be (5, 10), while in reality it is (10, 5). >>> y = numpy.arange(100).reshape((10,10)) >>> y[:,numpy.arange(5)].shape (10,5) >>> x = numpy.arange(100).reshape((1,10,10

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Stefan van der Walt
On Tue, Jun 19, 2007 at 12:35:05PM +0200, Sturla Molden wrote: > On 6/19/2007 12:14 PM, Sturla Molden wrote: > > > h[0,:,numpy.arange(14)] is a case of "sdvanced indexing". You can also > > see that > > > > >>> h[0,:,[0,1,2,3,4,5,6,7,8,9,10,11,12,13]].shape > > (14, 4) > > Another way to expla

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Sturla Molden
On 6/19/2007 12:14 PM, Sturla Molden wrote: > h[0,:,numpy.arange(14)] is a case of "sdvanced indexing". You can also > see that > > >>> h[0,:,[0,1,2,3,4,5,6,7,8,9,10,11,12,13]].shape > (14, 4) Another way to explain this is that numpy.arange(14) and [0,1,2,3,4,5,6,7,8,9,10,11,12,13] is a sequ

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Sturla Molden
On 6/19/2007 12:19 PM, Sven Schreiber wrote: > To be more specific, I would expect shape==(4,14). >>> h = numpy.zeros((1,4,14)) >>> h[0,:,numpy.arange(14)].shape (14, 4) >>> h[0,:,:].shape (4, 14) >>> h[0,:,numpy.arange(14)] is a case of "sdvanced indexing". You can also see that >>> h[

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Sven Schreiber
Sven Schreiber schrieb: > Tom K. schrieb: > h = zeros((1, 4, 100)) > h[0,:,arange(14)].shape >> (14, 4) >> > > After reading section 3.4.2.1 of the numpy book, I also still don't > expect this result. So if it's not a bug, I'd be glad if some expert > could explain why not. > To be more

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-16 Thread Sven Schreiber
Tom K. schrieb: h = zeros((1, 4, 100)) h[0,:,arange(14)].shape > (14, 4) > After reading section 3.4.2.1 of the numpy book, I also still don't expect this result. So if it's not a bug, I'd be glad if some expert could explain why not. Thanks, Sven __

[Numpy-discussion] Is this an indexing bug?

2007-06-15 Thread Tom K.
>>> h = zeros((1, 4, 100)) >>> h[0,:,arange(14)].shape (14, 4) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion