numpy.broadcast
- 
class numpy.broadcast[source]
- 
Produce an object that mimics broadcasting. Parameters: in1, in2, ... : array_like Input parameters. Returns: b : broadcast object Broadcast the input parameters against one another, and return an object that encapsulates the result. Amongst others, it has shapeandndproperties, and may be used as an iterator.ExamplesManually adding two vectors, using broadcasting: >>> x = np.array([[1], [2], [3]]) >>> y = np.array([4, 5, 6]) >>> b = np.broadcast(x, y) >>> out = np.empty(b.shape) >>> out.flat = [u+v for (u,v) in b] >>> out array([[ 5., 6., 7.], [ 6., 7., 8.], [ 7., 8., 9.]])Compare against built-in broadcasting: >>> x + y array([[5, 6, 7], [6, 7, 8], [7, 8, 9]])Attributesindexcurrent index in broadcasted result iterstuple of iterators along self‘s “components.”shapeShape of broadcasted result. sizeTotal size of broadcasted result. Methodsnextx.next() -> the next value, or raise StopIteration reset()Reset the broadcasted result’s iterator(s). 
    © 2008–2016 NumPy Developers
Licensed under the NumPy License.
    https://docs.scipy.org/doc/numpy-1.11.0/reference/generated/numpy.broadcast.html