Algosim documentation: IsDiagonal

IsDiagonal

Tests if a matrix is diagonal.

Syntax

Description

If A is a matrix, not necessarily square, then IsDiagonal(A, ε) is true iff i ≠ j implies A[i, j] = 0 (with epsilon ε).

Examples

A ≔ IdentityMatrix(100); B ≔ ❨❨4, 0, 0❩, ❨0, i, 0❩❩; C ≔ ❨❨5, 0❩, ❨0, 1❩, ❨0, 0❩❩;
∀({A, B, C}, (x ↦ IsDiagonal(x)))
true

See also