roll#
- class saiunit.math.roll(a, shift, axis=None, **kwargs)#
Roll quantity or array elements along a given axis.
- Parameters:
a (
Array| saiunit.Quantity) – Input array.shift (
int|Tuple[int,...]) – The number of places by which elements are shifted. If a tuple, then axis must be a tuple of the same size, and each of the given axes is shifted by the corresponding number. If an int while axis is a tuple of ints, then the same value is used for all given axes.axis (
int|Tuple[int,...] |None) – Axis or axes along which elements are shifted. By default, the array is flattened before shifting, after which the original shape is restored.
- Returns:
res – Output array, with the same shape as a.
- Return type:
Array| saiunit.Quantity
Examples
>>> import saiunit as u >>> a = [1, 2, 3] * u.second >>> u.math.roll(a, 1)