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

bundles / numpy 2.4.3 / numpy / linalg / LinAlgError

class

numpy.linalg:LinAlgError

source: /numpy/linalg/__init__.py

Summary

Generic Python-exception-derived object raised by linalg functions.

Extended Summary

General purpose exception class, derived from Python's ValueError class, programmatically raised in linalg functions when a Linear Algebra-related condition would prevent further correct execution of the function.

Parameters

None

Examples

from numpy import linalg as LA
LA.inv(np.zeros((2,2)))
✓
Traceback (most recent call last):
  File "<doctest numpy.linalg:LinAlgError[0]>", line 1, in <module>
    LA.inv(np.zeros((2,2)))
    ~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.14.7/x64/lib/python3.14/site-packages/numpy/linalg/_linalg.py", line 648, in inv
    ainv = _umath_linalg.inv(a, signature=signature)
  File "/opt/hostedtoolcache/Python/3.14.7/x64/lib/python3.14/site-packages/numpy/linalg/_linalg.py", line 145, in _raise_linalgerror_singular
    raise LinAlgError("Singular matrix")
numpy.linalg.LinAlgError: Singular matrix

Aliases

  • numpy.linalg.LinAlgError