split#
- class brainunit.math.split(a, indices_or_sections, axis=0, **kwargs)#
Split quantity or array into a list of multiple sub-arrays.
- Parameters:
a (
Array| saiunit.Quantity) – Array to be divided into sub-arrays.indices_or_sections (
int|Sequence[int]) – If indices_or_sections is an integer, N, the array will be divided into N equal arrays along axis. If such a split is not possible, an error is raised. If indices_or_sections is a 1-D array of sorted integers, the entries indicate where along axis the array is split. For example, [2, 3] would, for axis=0, result in - a[:2] - a[2:3] - a[3:]axis (
int) – The axis along which to split, default is 0.
- Returns:
res – A list of sub-arrays.
- Return type:
Sequence[saiunit.Quantity |Array]
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> a = jnp.arange(9.0) * u.second >>> u.math.split(a, 3)