array_split

Contents

array_split#

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

Split an array into multiple sub-arrays.

Parameters:
  • ary (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Array to be divided into sub-arrays.

  • indices_or_sections (int | Array | ndarray | bool | number | bool | float | complex) – 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 (int | None) – The axis along which to split, default is 0.

Returns:

sub-arrays – 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.array_split(a, 3)