/**
   * Internal routine for storing a submatrix into and AbstractMTJMatrix. Gets the embedded
   * submatrix inside of the Matrix, specified by the inclusive, zero-based indices such that the
   * result matrix will have size (maxRow-minRow+1) x (maxColum-minCcolumn+1)
   *
   * @param minRow Zero-based index into the rows of the Matrix, must be less than or equal to
   *     maxRow
   * @param maxRow Zero-based index into the rows of the Matrix, must be greater than or equal to
   *     minRow
   * @param minColumn Zero-based index into the rows of the Matrix, must be less than or equal to
   *     maxColumn
   * @param maxColumn Zero-based index into the rows of the Matrix, must be greater than or equal to
   *     minColumn
   * @param destinationMatrix the destination submatrix of dimension
   *     (maxRow-minRow+1)x(maxColumn-minColumn+1)
   */
  protected void getSubMatrixInto(
      int minRow, int maxRow, int minColumn, int maxColumn, AbstractMTJMatrix destinationMatrix) {

    if ((destinationMatrix.getNumRows() != (maxRow - minRow + 1))
        || (destinationMatrix.getNumColumns() != (maxColumn - minColumn + 1))) {
      throw new DimensionalityMismatchException("Submatrix is incorrect size.");
    }

    for (int i = minRow; i <= maxRow; i++) {
      for (int j = minColumn; j <= maxColumn; j++) {
        destinationMatrix.setElement(i - minRow, j - minColumn, this.getElement(i, j));
      }
    }
  }