IsBinary
Tests if a matrix contains only 0s and 1s
Syntax
-
IsBinary(A[, ε])
-
A
is a matrix -
ε
is a positive number
-
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