rangeUnchecked method
Returns a mutable view onto the row and column ranges. The behavior is undefined if any of the ranges are out of bounds.
Implementation
Matrix<T> rangeUnchecked(
int rowStart, int rowEnd, int columnStart, int columnEnd) {
if (rowStart == 0 &&
rowEnd == rowCount &&
columnStart == 0 &&
columnEnd == colCount) return this;
return switch (this) {
RangeMatrix<T>(
matrix: final thisMatrix,
rowStart: final thisRowStart,
columnStart: final thisColumnStart
) =>
RangeMatrix<T>(
thisMatrix,
thisRowStart + rowStart,
thisRowStart + rowEnd,
thisColumnStart + columnStart,
thisColumnStart + columnEnd),
_ => RangeMatrix<T>(this, rowStart, rowEnd, columnStart, columnEnd),
};
}