[Numpy-discussion] Logical indexing and higher-dimensional arrays.

Sturla Molden sturla@molden...
Wed Feb 8 08:29:30 CST 2012


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)" whose elements are selected by the broadcasted tuple.




Thank you for the explanation, Travis.

I think my main confusion is why we broadcast indices at all. 
Broadcasting is something I would expect to happen for binary operations 
between ndarrays, not for indexing.

(But it might be that I don't fully understand the problem.)

Sturla


More information about the NumPy-Discussion mailing list