cirq.unitary_eig

cirq.unitary_eig(matrix: numpy.ndarray, check_preconditions: bool = True, atol: float = 1e-08) → Tuple[numpy.array, numpy.ndarray][source]

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.
Parameters
  • 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

Returns

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

Return type

eigvals