isToeplitzMatrix method
Checks if the matrix is a Toeplitz matrix.
A Toeplitz matrix is a matrix in which each descending diagonal from left to right is constant.
tolerance
is the numerical tolerance used to compare the elements.
Default value for tolerance
is 1e-10.
Returns true
if the matrix is tridiagonal, false
otherwise.
Implementation
bool isToeplitzMatrix({num tolerance = 1e-10}) {
for (int i = 0; i < rowCount - 1; i++) {
for (int j = 0; j < columnCount - 1; j++) {
if ((_data[i][j] - _data[i + 1][j + 1]).abs() > Complex(tolerance)) {
return false;
}
}
}
return true;
}