call method
Use this method to retrieve the element at a given position in the matrix. For example:
final matrix = Matrix(
rowCount: 3,
columnCount: 3,
);
final value = matrix(2, 1);
In the above example, you're accessing the double at position (3, 2)
.
This method is an alias of itemAt.
Implementation
T call(int row, int col) {
if ((row >= rowCount) || (col >= columnCount)) {
throw const MatrixException('The given indices are out of the bounds.');
}
// Data are stored sequentially so there's the need to work with the indices
return _data[columnCount * row + col];
}