matrix_transpose

Contents

matrix_transpose#

class brainunit.linalg.matrix_transpose(x, **kwargs)#

Transpose a matrix or stack of matrices.

SaiUnit implementation of numpy.linalg.matrix_transpose().

Parameters:

x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input of shape (..., M, N).

Returns:

out – Transposed array of shape (..., N, M). Carries the same unit as x.

Return type:

saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> x = jnp.array([[1, 2, 3],
...                [4, 5, 6]]) * u.meter
>>> u.linalg.matrix_transpose(x)
ArrayImpl([[1, 4],
           [2, 5],
           [3, 6]], dtype=int32) * meter