Algosim documentation: IsCentrosymmetric

IsCentrosymmetric

Tests if a matrix is centrosymmetric.

Syntax

Description

If A is a matrix, then IsCentrosymmetric(A, ε) returns true iff A is a centrosymmetric matrix, that is, iff it is square and

A[i, j] = A[n − i + 1, n − j + 1]

for all indices i, j, where n is the size of A. Floating-point comparisons are made with epsilon ε.

Examples

A ≔ ❨❨5, 3, 1, 3, 5❩, ❨2, 7, 3, 7, 2❩, ❨6, 4, 2, 4, 6❩, ❨2, 7, 3, 7, 2❩, ❨5, 3, 1, 3, 5❩❩
⎛5  3  1  3  5⎞
⎜2  7  3  7  2⎟
⎜6  4  2  4  6⎟
⎜2  7  3  7  2⎟
⎝5  3  1  3  5⎠
IsCentrosymmetric(A)
true