cirq.linalg.unitary_eig

Gives the guaranteed unitary eigendecomposition of a normal matrix.

All hermitian and unitary matrices are normal matrices. This method was introduced as for certain classes of unitary matrices (where the eigenvalues are close to each other) the eigenvectors returned by numpy.linalg.eig are not guaranteed to be orthogonal. For more information, see https://github.com/numpy/numpy/issues/15461

matrix a normal matrix. If not normal, this method is not guaranteed to return correct eigenvalues.
check_preconditions when true and matrix is not unitary, a ValueError is raised
atol the absolute tolerance when checking whether the original matrix was unitary

eigvals the eigenvalues of matrix
V the unitary matrix with the eigenvectors as columns