diagonal method

Vector<T> diagonal([
  1. int offset = 0
])

Returns a mutable diagonal Vector of this Matrix. Throws a RangeError, if offset is out of bounds. An offset of 0 refers to the diagonal in the center of the matrix, a negative offset to the diagonals above, and a positive offset to the diagonals below.

Implementation

Vector<T> diagonal([int offset = 0]) {
  RangeError.checkValueInInterval(
      offset, -colCount + 1, rowCount - 1, 'offset');
  return diagonalUnchecked(offset);
}