index method

Matrix<T> index(
  1. Iterable<int> rowIndexes,
  2. Iterable<int> colIndexes
)

Returns a mutable view onto row and column indexes. Throws a RangeError, if any of the indexes are out of bounds.

Implementation

Matrix<T> index(Iterable<int> rowIndexes, Iterable<int> colIndexes) {
  for (final index in rowIndexes) {
    RangeError.checkValueInInterval(index, 0, rowCount - 1, 'rowIndexes');
  }
  for (final index in colIndexes) {
    RangeError.checkValueInInterval(index, 0, colCount - 1, 'colIndexes');
  }
  return indexUnchecked(rowIndexes, colIndexes);
}