nlcpy.broadcast_to

nlcpy.broadcast_to(array, shape, subok=False)[source]

Broadcasts an array to a new shape.

Parameters
arrayarray_like

The array to broadcast.

shapesequence of ints

The shape of the desired array.

subokbool, optional

Not implemented.

Returns
broadcastndarray

A readonly view on the original array with the given shape. It is typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location.

Examples

>>> import nlcpy as vp
>>> x = vp.array([1, 2, 3])
>>> vp.broadcast_to(x, (3, 3))
array([[1, 2, 3],
       [1, 2, 3],
       [1, 2, 3]])