View source on GitHub |
Determines if a matrix is a approximately diagonal.
cirq.is_diagonal(
matrix: np.ndarray, *, atol: float = 1e-08
) -> bool
A matrix is diagonal if i!=j implies m[i,j]==0.
Args | |
---|---|
matrix
|
The matrix to check. |
atol
|
The per-matrix-entry absolute tolerance on equality. |
Returns | |
---|---|
Whether the matrix is diagonal within the given tolerance. |