cirq.is_normal

cirq.is_normal(matrix: numpy.ndarray, *, rtol: float = 1e-05, atol: float = 1e-08) → bool[source]

Determines if a matrix is approximately normal.

A matrix is normal if it’s square and commutes with its adjoint.

Parameters
  • matrix – The matrix to check.

  • rtol – The per-matrix-entry relative tolerance on equality.

  • atol – The per-matrix-entry absolute tolerance on equality.

Returns

Whether the matrix is normal within the given tolerance.