bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / linalg / matrix_norm
_ArrayFunctionDispatcher
numpy.linalg:matrix_norm
source: build-install/usr/lib/python3.14/site-packages/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_likeInput array having shape (..., M, N) and whose two innermost dimensions form
MxNmatrices.keepdims: bool, optionalIf 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'}, optionalThe order of the norm. For details see the table under
Notesin 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