repeat#
- class saiunit.math.repeat(a, repeats, axis=None, total_repeat_length=None, **kwargs)#
Repeat elements of a quantity or an array.
- Parameters:
a (
Union[Array, saiunit.Quantity]) – Input array.repeats (
Union[int,Tuple[int,...]]) – The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.axis (
Optional[int]) – The axis along which to repeat values. By default, use the flattened input array, and return a flat output array.total_repeat_length (
Optional[int]) – The total length of the repeated array. If total_repeat_length is not None, the output array will have the length of total_repeat_length.
- Returns:
res – Output array which has the same shape as a, except along the given axis.
- Return type:
Union[Array, saiunit.Quantity]
Examples
>>> import saiunit as u >>> a = [1, 2, 3] * u.second >>> u.math.repeat(a, 2)