Algosim documentation: IsPermutation

IsPermutation

Tests if a matrix is a permutation matrix.

Syntax

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

See also