transpose

Contents

transpose#

class saiunit.math.transpose(a, axes=None, **kwargs)#

Permute the dimensions of a quantity or an array.

Parameters:
  • a (Union[Array, saiunit.Quantity]) – Input array.

  • axes (Union[int, Tuple[int, ...], None]) – By default, reverse the dimensions, otherwise permute the axes according to the values given.

Returns:

pa with its axes permuted. A view is returned whenever possible.

Return type:

Union[Array, saiunit.Quantity]

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> a = jnp.ones((2, 3)) * u.second
>>> u.math.transpose(a).shape
(3, 2)