repeat#
- class brainunit.math.repeat(a, repeats, axis=None, total_repeat_length=None, **kwargs)#
Repeat elements of a quantity or an array.
- Parameters:
a (
Array| saiunit.Quantity) – Input array.repeats (
int|Tuple[int,...]) – The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.axis (
int|None) – The axis along which to repeat values. By default, use the flattened input array, and return a flat output array.total_repeat_length (
int|None) – 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:
Array| saiunit.Quantity
Examples
>>> import saiunit as u >>> a = [1, 2, 3] * u.second >>> u.math.repeat(a, 2)