cupy.linalg.eig#
- cupy.linalg.eig(a)[source]#
Return the eigenvalues and eigenvectors of a matrix.
Returns two objects, a 1-D array containing the eigenvalues of a, and a 2-D square array or matrix (depending on the input type) of the corresponding eigenvectors (in columns).
- Parameters:
a (cupy.ndarray) – A symmetric 2-D square matrix
(M, M)
or a batch of symmetric 2-D square matrices(..., M, M)
.- Returns:
Returns a tuple
(w, v)
.w
contains eigenvalues andv
contains eigenvectors.v[:, i]
is an eigenvector corresponding to an eigenvaluew[i]
. For batch input,v[k, :, i]
is an eigenvector corresponding to an eigenvaluew[k, i]
ofa[k]
.- Return type:
tuple of
ndarray
Notes
There is no guarantee of the order of the eigenvalues: it can even be different from
numpy.linalg.eig
.Warning
This function calls one or more cuSOLVER routine(s) which may yield invalid results if input conditions are not met. To detect these invalid results, you can set the linalg configuration to a value that is not ignore in
cupyx.errstate()
orcupyx.seterr()
.See also