mlx.core.linalg.det#
- det(a: array, *, stream: None | Stream | Device = None) array#
Compute the determinant of a square matrix.
This function supports arrays with at least 2 dimensions. When the input has more than two dimensions, the determinant is computed for each matrix in the last two dimensions.
- Parameters:
- Returns:
The determinant(s) of the input matrix (matrices).
- Return type:
Example
>>> A = mx.array([[1., 2.], [3., 4.]]) >>> mx.linalg.det(A, stream=mx.cpu) array(-2, dtype=float32)