[Numpy-discussion] another broadcast/fancy indexing question

Timothy Hochberg tim.hochberg@ieee....
Tue Jul 10 17:00:17 CDT 2007


On 7/10/07, Mark.Miller <mpmusu@cc.usu.edu> wrote:
>
> Sorry...can you clarify?  I think that some of your message got cut off.
>
> -Mark
>
> Timothy Hochberg wrote:
> > It's because you are using arrays as indices (aka Fancy-Indexing). When
> > you do this everything works differently. In this case, everything is
> > being broadcast to the same shape. As I understand it (and I try to use
> > only the simplest forms of fancy indexing), what you are doing is
> > equivalent to:



Sorry about that. The missing line is:

a[zeros([5,5]),:,b,c].shape

That is, your '0' is being broadcast into a 5x5 array to match the shapes of
b and c. That is why the two forms you give are not equivalent. As to why
you get that exact shape, I'd have to peruse the fancy indexing docs to
figure it out -- things are a little weird when you use multidimensional
indexing.


>
> > --
> > .  __
> > .   |-\
> > .
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
.  __
.   |-\
.
.  tim.hochberg@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070710/fc2a5d1b/attachment.html 


More information about the Numpy-discussion mailing list