mlx.core.linalg.eigvals#
- eigvals(a: array, *, stream: Optional[Union[Stream, Device]] = None) array#
- Compute the eigenvalues of a square matrix. - This function differs from - numpy.linalg.eigvals()in that the return type is always complex even if the eigenvalues are all real.- This function supports arrays with at least 2 dimensions. When the input has more than two dimensions, the eigenvalues are computed for each matrix in the last two dimensions. - Parameters:
- Returns:
- The eigenvalues (not necessarily in order). 
- Return type:
 - Example - >>> A = mx.array([[1., -2.], [-2., 1.]]) >>> eigenvalues = mx.linalg.eigvals(A, stream=mx.cpu) >>> eigenvalues array([3+0j, -1+0j], dtype=complex64) 
