numpoly.repeat¶
- numpoly.repeat(a: numpoly.typing.PolyLike, repeats: Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], axis: int = 0) → numpoly.baseclass.ndpoly[source]¶
Repeat elements of an array.
- Args:
- a:
Input array.
- repeats:
The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.
- axis:
The axis along which to repeat values. By default, use the flattened input array, and return a flat output array.
- Return:
Output array which has the same shape as a, except along the given axis.
- Example:
>>> q0 = numpoly.variable() >>> numpoly.repeat(q0, 4) polynomial([q0, q0, q0, q0]) >>> poly = numpoly.polynomial([[1, q0-1], [q0**2, q0]]) >>> numpoly.repeat(poly, 2) polynomial([[1, q0-1], [1, q0-1], [q0**2, q0], [q0**2, q0]]) >>> numpoly.repeat(poly, 3, axis=1) polynomial([[1, 1, 1, q0-1, q0-1, q0-1], [q0**2, q0**2, q0**2, q0, q0, q0]]) >>> numpoly.repeat(poly, [1, 2], axis=0) polynomial([[1, q0-1], [q0**2, q0], [q0**2, q0]])