code: public void set(int row, int col, double val) {
          checkIndices(row, col);
  
          if (row != col) {
              throw new IllegalArgumentException(
                      "cannot set non-diagonal elements in a DiagonalMatrix");
          }
          values[row] = val;
      }
docs: {@inheritDoc}
  
  @throws IllegalArgumentException if {@code row != col}