You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / linalg / matrix_norm

_ArrayFunctionDispatcher

numpy.linalg:matrix_norm

source: /numpy/linalg/_linalg.py :3446

Signature

def   matrix_norm ( x / keepdims = False ord = fro )

Summary

Computes the matrix norm of a matrix (or a stack of matrices) x.

Extended Summary

This function is Array API compatible.

Parameters

x : array_like

Input array having shape (..., M, N) and whose two innermost dimensions form MxN matrices.

keepdims : bool, optional

If this is set to True, the axes which are normed over are left in the result as dimensions with size one. Default: False.

ord : {1, -1, 2, -2, inf, -inf, 'fro', 'nuc'}, optional

The order of the norm. For details see the table under Notes in numpy.linalg.norm.

Examples

from numpy import linalg as LA
a = np.arange(9) - 4
a
b = a.reshape((3, 3))
b
LA.matrix_norm(b)
LA.matrix_norm(b, ord='fro')
LA.matrix_norm(b, ord=np.inf)
LA.matrix_norm(b, ord=-np.inf)
LA.matrix_norm(b, ord=1)
LA.matrix_norm(b, ord=-1)
LA.matrix_norm(b, ord=2)
LA.matrix_norm(b, ord=-2)

See also

numpy.linalg.norm

Generic norm function

Aliases

  • numpy.linalg.matrix_norm

Referenced by