array_split

Contents

array_split#

class saiunit.math.array_split(ary, indices_or_sections, axis=0, **kwargs)#

Split an array into multiple sub-arrays.

Parameters:
  • ary (Union[saiunit.Quantity, Array, ndarray, number, bool]) – Array to be divided into sub-arrays.

  • indices_or_sections (Union[int, Array, ndarray, number, bool]) – If indices_or_sections is an integer, ary is divided into indices_or_sections sub-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.

  • axis (Optional[int]) – The axis along which to split, default is 0.

Returns:

sub-arrays – A list of sub-arrays.

Return type:

Sequence[Union[saiunit.Quantity, Array]]

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> a = jnp.arange(9.0) * u.second
>>> u.math.array_split(a, 3)