cirq.linalg.is_diagonal

Determines if a matrix is a approximately diagonal.

A matrix is diagonal if i!=j implies m[i,j]==0.

matrix The matrix to check.
atol The per-matrix-entry absolute tolerance on equality.

Whether the matrix is diagonal within the given tolerance.