vsplit

Contents

vsplit#

class brainunit.math.vsplit(a, indices_or_sections, **kwargs)#

Split a quantity or an array into multiple sub-arrays vertically (row-wise).

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 the first 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 the first axis the array is split.

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(16.0).reshape(4, 4) * u.meter
>>> u.math.vsplit(a, 2)