[Numpy-discussion] question about subtraction and shape

Jonas Wallin jonas.wallin81@gmail....
Thu Sep 1 16:33:20 CDT 2011


Hello,

I implemented the following line of code:

Gami[~index0].shape ----> (100,)
sigma.shape             ----> (1,1)
Gami[~index0]  = Gam[~index0] - sigma**2

I get the error message:
*** ValueError: array is not broadcastable to correct shape

apparently
*temp* = Gam[~index0] - sigma**2
*temp*.shape -->  (1,100)

Which seems strange to me is there any reason why *temp* gets this shape ?

mvh
Jonas Wallin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110901/2e33e9fc/attachment.html 


More information about the NumPy-Discussion mailing list