isPeriodicMatrix method
Checks if the matrix is a periodic matrix.
Example:
Matrix J = Matrix([
[0, 1],
[-1, 0]
]);
print(J.isPeriodicMatrix()); // Output: true
Implementation
bool isPeriodicMatrix(int period, {num tolerance = 1e-10}) {
Matrix product = copy();
for (int i = 1; i <= period; i++) {
product = product * this;
if (product.isIdentityMatrix(tolerance: tolerance)) {
return true;
}
}
return false;
}