Algosim documentation: IsTridiagonal

IsTridiagonal

Tests if a matrix is tridiagonal.

Syntax

Description

If A is a matrix then IsTridiagonal(A, ε) is true iff A is square and abs(i, j) > 1 implies A[i, j] = 0 (with epsilon ε).

Examples

❨❨3, 0, 0, 0❩, ❨1, 2, 1, 0❩, ❨0, 4, 1, 3❩, ❨0, 0, 0, 1❩❩
⎛3  0  0  0⎞
⎜1  2  1  0⎟
⎜0  4  1  3⎟
⎝0  0  0  1⎠
IsTridiagonal(ans)
true

See also