matrix_norm

Contents

matrix_norm#

class saiunit.linalg.matrix_norm(x, *, keepdims=False, ord='fro', **kwargs)#

Compute the norm of a matrix or stack of matrices.

SaiUnit implementation of numpy.linalg.matrix_norm().

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

  • keepdims (bool) – If True, reduced axes are kept as size-1 dimensions (default: False).

  • ord (int | str) – Type of matrix norm (default: 'fro'). See numpy.linalg.norm() for available options.

Returns:

out – Matrix norm with shape x.shape[:-2] (or (..., 1, 1) when keepdims is True). Carries the same unit as x.

Return type:

Array | saiunit.Quantity

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> x = jnp.array([[1, 2, 3],
...                [4, 5, 6],
...                [7, 8, 9]]) * u.second
>>> u.linalg.matrix_norm(x)
16.881943 * second