code: public void set(int row, int col, double val) {
          checkIndices(row, col);
  
          // Check whether the dimensions need to be updated
          if (row + 1 > rows)
              rows = row + 1;
          if (col + 1 > cols)
              cols = col + 1;
  
          updateRow(row).set(col, val);
      }
docs: {@inheritDoc}
  
  <p>The size of the matrix will be expanded if either row or col is larger
  than the largest previously seen row or column value.    When the matrix
  is expanded by either dimension, the values for the new row/column will
  all be assumed to be zero.