[Numpy-discussion] question about subtraction and shape

Jonas Wallin jonas.wallin81 at gmail.com
Thu Sep 1 17:33:20 EDT 2011


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

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

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

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

More information about the NumPy-Discussion mailing list