DiagonalMatrixQ
DiagonalMatrixQ(matrix)DiagonalMatrixQ(matrix, diagonal)returns
Trueif all elements of thematrixare0except the elements on thediagonal.
Examples
>> DiagonalMatrixQ({{a, 0, 0}, {b, 0, 0}, {0, 0, c}})False
>> DiagonalMatrixQ({{0, a, 0, 0}, {0, 0, b, 0}, {0, 0, 0, c}}, 1)True
>> DiagonalMatrixQ({{0, a, 0, 0}, {0, 0, b, 0}, {0, 0, c, 0}}, -1)False
>> DiagonalMatrixQ({{0, 0, 0, 0}, {a, 0, 0, 0}, {0, b, 0, 0}}, -1)TrueImplementation status
- ✅ - full supported