[Numpy-discussion] sum of two arrays with different shape?
zhangyunfeng at gmail.com
Mon Dec 18 19:45:04 CST 2006
2006/12/18, Robert Kern <robert.kern at gmail.com>:
> zhang yunfeng wrote:
> > Hi, I'm newbie to Numpy.
> > When reading tutorials at
> > http://www.scipy.org/Tentative_NumPy_Tutorial
> > <http://www.scipy.org/Tentative_NumPy_Tutorial>, I found a snippet about
> > addition of two arrays with different shape, Does it make sense? If
> > array shapes are not same, why it doesn't throw out an error?
> When two arrays of different shapes are operated against each other, numpy
> to "broadcast" them to a compatible shape according to certain rules. This
> is a
> fairly powerful concept, and it provides quite a lot of convenience. The
> following wiki page has an explanation of the broadcasting rules:
Yes, It seems powerful. But If one happened to add two incompatible array
by mistake, Does the result make sense? May be the broadcast feature should
be limited in a certain range not to mess normal operation.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion