cirq.is_unitary¶

cirq.is_unitary(matrix: numpy.ndarray, tolerance: cirq.linalg.tolerance.Tolerance = Tolerance(rtol=1e-05, atol=1e-08, equal_nan=False)) → bool[source]

Determines if a matrix is approximately unitary.

A matrix is unitary if it’s square and its adjoint is its inverse.

Parameters: matrix – The matrix to check. tolerance – The per-matrix-entry tolerance on equality. Whether the matrix is unitary within the given tolerance.