On Wed, Feb 8, 2012 at 6:49 AM, Travis Oliphant wrote:
> There are also some very nice applications where you can select out of a 3-d
> volume a depth-surface defined by indexes like so:
>
> arr[ i[:,newaxis], j, depth]
>
> where arr is a 3-d array, i and j are 1-d index arrays: i =
> ar
On Feb 8, 2012, at 4:19 PM, Robert Kern wrote:
> On Wed, Feb 8, 2012 at 22:11, Travis Oliphant wrote:
>>
>> On Feb 8, 2012, at 11:17 AM, josef.p...@gmail.com wrote:
>>
>>> On Wed, Feb 8, 2012 at 10:29 AM, Sturla Molden wrote:
On 08.02.2012 15:49, Travis Oliphant wrote:
> This s
On Wed, Feb 8, 2012 at 22:11, Travis Oliphant wrote:
>
> On Feb 8, 2012, at 11:17 AM, josef.p...@gmail.com wrote:
>
>> On Wed, Feb 8, 2012 at 10:29 AM, Sturla Molden wrote:
>>> On 08.02.2012 15:49, Travis Oliphant wrote:
>>>
This sort of thing would take time, but is not out of the question
On Feb 8, 2012, at 11:17 AM, josef.p...@gmail.com wrote:
> On Wed, Feb 8, 2012 at 10:29 AM, Sturla Molden wrote:
>> On 08.02.2012 15:49, Travis Oliphant wrote:
>>
>>> This sort of thing would take time, but is not out of the question in my
>>> mind because I suspect the number of users and use
On Wed, Feb 8, 2012 at 8:49 AM, Travis Oliphant wrote:
>
> On Feb 8, 2012, at 8:29 AM, Sturla Molden wrote:
>
> > On 08.02.2012 06:01, Travis Oliphant wrote:
> >
> >> Recall that the shape of the output with fancy indexing is determined
> by broadcasting together the indexing objects and using th
On 08.02.2012 18:17, josef.p...@gmail.com wrote:
> I think I use it quite a bit, and I like that the broadcasting in
> indexing is as flexible as the broadcasting of numpy arrays
> themselves.
>
> x[np.arange(len(x)), np.arange(len(x))] gives the diagonal for example.
Personally I would prefer
On Wed, Feb 8, 2012 at 10:29 AM, Sturla Molden wrote:
> On 08.02.2012 15:49, Travis Oliphant wrote:
>
>> This sort of thing would take time, but is not out of the question in my
>> mind because I suspect the number of users and use-cases of "broadcasted"
>> fancy-indexing is small.
I think I us
On 08.02.2012 15:49, Travis Oliphant wrote:
> This sort of thing would take time, but is not out of the question in my mind
> because I suspect the number of users and use-cases of "broadcasted"
> fancy-indexing is small.
In Matlab this (misfeature?) is generally used to compensate for the
lac
On 08.02.2012 15:11, Olivier Delalleau wrote:
> From a user perspective, I would definitely prefer cross-product
> semantics for fancy indexing. In fact, I had never used fancy indexing
> with more than one array index, so the behavior described in this thread
> totally baffled me. If for instanc
On Feb 8, 2012, at 8:29 AM, Sturla Molden wrote:
> On 08.02.2012 06:01, Travis Oliphant wrote:
>
>> Recall that the shape of the output with fancy indexing is determined by
>> broadcasting together the indexing objects and using that as the shape of
>> the output:
>>
>> x[ind1, ind2] will pro
On 08.02.2012 06:01, Travis Oliphant wrote:
> Recall that the shape of the output with fancy indexing is determined by
> broadcasting together the indexing objects and using that as the shape of the
> output:
>
> x[ind1, ind2] will produce an output with the shape of "broadcast(ind1,
> ind2)" w
Le 8 février 2012 00:01, Travis Oliphant a écrit :
>
> On Feb 7, 2012, at 12:24 PM, Sturla Molden wrote:
>
> > On 07.02.2012 19:17, Benjamin Root wrote:
> >
> > print x.shape
> >> (2, 3, 4)
> > print x[0, :, :].shape
> >> (3, 4)
> > print x[0, :, idx].shape
> >> (2, 3)
> >
> > That lo
On Tue, Feb 7, 2012 at 9:01 PM, Travis Oliphant wrote:
> like so: x[ind1, :, ind2], the question is what should the shape of the
> output me. If ind1 is a scalar there is no ambiguity (and this should be
> special cased --- but unfortunately isn't).
If
x.shape == (a0, a1, a2)
ind1.shape ==
On Feb 7, 2012, at 12:24 PM, Sturla Molden wrote:
> On 07.02.2012 19:17, Benjamin Root wrote:
>
> print x.shape
>> (2, 3, 4)
> print x[0, :, :].shape
>> (3, 4)
> print x[0, :, idx].shape
>> (2, 3)
>
> That looks like a bug to me. The length of the first dimension should be
> the sa
This comes up from time to time.This is an example of what is described at
the top of page 84 of "Guide to NumPy". Also read Chapter 17 to get the
explanation of how fancy indexing is implemented if you really want to
understand the issues.
When you mix fancy-indexing with "simple indexin
On Tue, Feb 7, 2012 at 10:41 AM, Sturla Molden wrote:
> It's the combination of a single index and fancy indexing that does
> this, not the slicing.
There are some quirks in the broadcasting machinery that makes it
almost impossible to guess what the outcome of mixed indexing is going
to be. The
On 07.02.2012 19:24, Sturla Molden wrote:
> On 07.02.2012 19:17, Benjamin Root wrote:
>
>> >>> print x.shape
>> (2, 3, 4)
>> >>> print x[0, :, :].shape
>> (3, 4)
>> >>> print x[0, :, idx].shape
>> (2, 3)
>
> That looks like a bug to me. The length of the first dimension should be
> the sam
On 07.02.2012 19:17, Benjamin Root wrote:
> >>> print x.shape
> (2, 3, 4)
> >>> print x[0, :, :].shape
> (3, 4)
> >>> print x[0, :, idx].shape
> (2, 3)
That looks like a bug to me. The length of the first dimension should be
the same.
Sturla
__
On Tue, Feb 7, 2012 at 11:11 AM, Jordi Gutiérrez Hermoso wrote:
> Consider the following. Is this a bug?
>
> Thanks,
> - Jordi G. H.
>
> ---
> #!/usr/bin/python
>
> import numpy as np
>
> x = np.reshape(np.random.uniform(size=2*3*4), [2,3,4])
>
> idx =
Consider the following. Is this a bug?
Thanks,
- Jordi G. H.
---
#!/usr/bin/python
import numpy as np
x = np.reshape(np.random.uniform(size=2*3*4), [2,3,4])
idx = np.array([False, True, False, True])
y = x[0,:,:];
## Why is this transposed?
print x[
20 matches
Mail list logo