Compute the determinant of an array.
Input array to compute determinants for.
Determinant of a.
See also
slogdetAnother way to represent the determinant, more suitable for large matrices where underflow/overflow may occur.
scipy.linalg.detSimilar function in SciPy.
Broadcasting rules apply, see the numpy.linalg documentation for details.
The determinant is computed via LU factorization using the LAPACK routine z/dgetrf.
The determinant of a 2-D array [[a, b], [c, d]] is ad - bc:
>>> import numpy as np >>> a = np.array([[1, 2], [3, 4]]) >>> np.linalg.det(a) -2.0 # may vary
Computing determinants for a stack of matrices:
>>> a = np.array([ [[1, 2], [3, 4]], [[1, 2], [2, 1]], [[1, 3], [3, 1]] ]) >>> a.shape (3, 2, 2) >>> np.linalg.det(a) array([-2., -3., -8.])
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.linalg.det.html