Algosim documentation: IsBinary

IsBinary

Tests if a matrix contains only 0s and 1s

Syntax

Description

If A is a matrix, then IsBinary(A, ε) returns true iff A consists of only 0s and 1s. Floating-point comparisons are made with epsilon ε.

Examples

A ≔ ❨❨0, 1, 1, 1, 0❩, ❨0, 1, 0, 0, 1❩, ❨0, 1, 1, 1, 1❩❩
⎛0  1  1  1  0⎞
⎜0  1  0  0  1⎟
⎝0  1  1  1  1⎠
IsBinary(A)
true

See also