mlx.core.linalg.det

目录

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.

参数:
  • a (array) -- Input array.

  • stream (Stream, optional) -- Stream or device. Defaults to None in which case the default stream of the default device is used.

返回:

The determinant(s) of the input matrix (matrices).

返回类型:

array

示例

>>> A = mx.array([[1., 2.], [3., 4.]])
>>> mx.linalg.det(A, stream=mx.cpu)
array(-2, dtype=float32)