Determines if two matrices approximately commute.
cirq.matrix_commutes(
m1: np.ndarray, m2: np.ndarray, *, rtol: float = 1e-05, atol: float = 1e-08
) -> bool
Two matrices A and B commute if they are square and have the same size and
AB = BA.
Args |
m1
|
One of the matrices.
|
m2
|
The other matrix.
|
rtol
|
The per-matrix-entry relative tolerance on equality.
|
atol
|
The per-matrix-entry absolute tolerance on equality.
|
Returns |
Whether the two matrices have compatible sizes and a commutator equal
to zero within tolerance.
|