chainerx.linalg.eigh

chainerx.linalg.eigh(a, UPLO='L')

Compute the eigenvalues and eigenvectors of a real symmetric matrix.

Parameters
  • a (ndarray) – Real symmetric matrix whose eigenvalues and eigenvectors are to be computed.

  • UPLO (str) – Specifies whether the calculation is done with the lower triangular part of a (‘L’, default) or the upper triangular part (‘U’).

Returns

Returns a tuple (w, v). w contains eigenvalues and v contains eigenvectors. v[:, i] is an eigenvector corresponding to an eigenvalue w[i].

Return type

tuple of ndarray

Note

Although UPLO can be specified to ignore either the strictly lower or upper part of the input matrix, the backward computation assumes that the inputs is symmetric and the computed gradient is always a symmetric matrix with respect to UPLO. More specifically, the gradient is computed as if the function is restricted to a Riemannian submanifold of \(R^{n \times n}\) consisting just of symmetric matrices and is faithful to the mathematical definition of the eigenvalue decomposition of symmetric matrices.

Note

The dtype must be float32 or float64 (float16 is not supported yet.)