### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Linear algebra (`numpy.linalg`) »

# numpy.linalg.norm

`numpy.linalg.``norm`(x, ord=None)

  Matrix or vector norm.

  Parameters: | x : array_like, shape (M,) or (M, N) Input array. ord : {int, 1, -1, 2, -2, inf, -inf, ‘fro’} Order of the norm (see table under `Notes`).
  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.

  The following norms can be calculated:

  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)

### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Linear algebra (`numpy.linalg`) »