IsPermutation
Tests if a matrix is a permutation matrix.
Syntax
-
IsPermutation(A[, ε])
-
A
is a matrix -
ε
is a positive number
-
Description
If A
is a matrix, then IsPermutation(A, ε)
returns true
iff A
is a permutation matrix. A permutation matrix is a square binary matrix with the additional property that each row and each column contains exactly one 1
. Floating-point comparisons are made with epsilon ε
.
Examples
A ≔ ❨❨1, 0, 0, 0, 0❩, ❨0, 0, 1, 0, 0❩, ❨0, 1, 0, 0, 0❩, ❨0, 0, 0, 0, 1❩, ❨0, 0, 0, 1, 0❩❩
⎛1 0 0 0 0⎞ ⎜0 0 1 0 0⎟ ⎜0 1 0 0 0⎟ ⎜0 0 0 0 1⎟ ⎝0 0 0 1 0⎠
IsPermutation(A)
true