DiagonalMatrixQ¶
True if a matrix is diagonal.
DiagonalMatrixQ[m, k] tests whether the nonzero entries lie only on the
k-th diagonal (positive k for super-, negative for sub-diagonals).
Rectangular matrices are accepted.
A non-matrix argument (scalar, symbol, vector) is not diagonal.