- sparse.roll(a, shift, axis=None)[source]
Shifts elements of an array along specified axis. Elements that roll beyond the last position are circulated and re-introduced at the first.
a (COO) – Input array
shift (int or tuple of ints) – Number of index positions that elements are shifted. If a tuple is provided, 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 broadcasting is used so the same shift is applied to all axes.
axis (int or tuple of ints, optional) – Axis or tuple specifying multiple axes. By default, the array is flattened before shifting, after which the original shape is restored.
res – Output array, with the same shape as a.
- Return type: