pygsti.tools.matrixtools.eigendecomposition#
- eigendecomposition(m, *, assume_hermitian=None, assume_normal=False, tol=1e-12)#
Eigendecompose a square matrix as m = evecs @ diag(evals) @ inv_evecs.
- Parameters:
m (numpy array) – The matrix to eigendecompose.
assume_hermitian (bool, optional) – If True, m is (numerically symmetrized and) eigendecomposed with numpy.linalg.eigh, which is faster and more numerically stable than the general-purpose path, and guarantees a unitary evecs. If None (the default), this is inferred by testing m for Hermiticity, regardless of assume_normal.
assume_normal (bool, optional) – If True, and m is not (found or assumed) to be Hermitian, m is assumed to be a normal operator and is eigendecomposed via a complex Schur decomposition, whose triangular factor is verified to be diagonal (up to tol).
tol (float, optional) – Only used when the assume_normal path is taken. The off-diagonal norm of the Schur triangular factor is compared against tol times the norm of its diagonal; a ValueError is raised if the off-diagonal contribution is too large for m to be considered normal.
- Returns:
evecs (numpy array) – The eigenvectors of m, as columns.
evals (numpy array) – The eigenvalues of m.
inv_evecs (numpy array) – The matrix inverse of evecs