code: public static MatrixAccumulator asProductFunctionAccumulator(final double neutral,
                                                                   final MatrixFunction function) {
          return new MatrixAccumulator() {
              private final MatrixAccumulator productAccumulator = Matrices.asProductAccumulator(neutral);
  
              @Override
              public void update(int i, int j, double value) {
                  productAccumulator.update(i, j, function.evaluate(i, j, value));
              }
  
              @Override
              public double accumulate() {
                  return productAccumulator.accumulate();
              }
          };
      }
docs: Creates a product function accumulator, that calculates the product of
  all elements in the matrix after applying given {@code function} to
  each of them.
  
  @param neutral the neutral value
  @param function the matrix function
  
  @return a product function accumulator