code: public void update(MatrixFunction function) {
          MatrixIterator it = iterator();
  
          while (it.hasNext()) {
              double x = it.next();
              int i = it.rowIndex();
              int j = it.columnIndex();
              it.set(function.evaluate(i, j, x));
          }
      }
docs: Updates all elements of this matrix by applying given {@code function}.
  
  @param function the matrix function