scipy.linalg.norm

scipy.linalg.norm(x, ord=None)

Matrix or vector norm.

Parameters:

x : array, shape (M,) or (M, N)

ord : number, or {None, 1, -1, 2, -2, inf, -inf, ‘fro’}

Order of the norm:

ord

norm for matrices

norm for vectors

None

Frobenius norm

2-norm

‘fro’

Frobenius norm

inf

max(sum(abs(x), axis=1))

max(abs(x))

-inf

min(sum(abs(x), axis=1))

min(abs(x))

1

max(sum(abs(x), axis=0))

as below

-1

min(sum(abs(x), axis=0))

as below

2

2-norm (largest sing. value)

as below

-2

smallest singular value

as below

other

sum(abs(x)**ord)**(1./ord)

Returns:

n : float

Norm of the matrix or vector

Notes

For values ord < 0, the result is, strictly speaking, not a mathematical ‘norm’, but it may still be useful for numerical purposes.

Previous topic

scipy.linalg.det

Next topic

scipy.linalg.lstsq

This Page

Quick search