class CommonsMathWrapper {

  public static MultivariateRealFunction wrap(final FunctionND<Double, Double> f) {
    Validate.notNull(f);
    return new MultivariateRealFunction() {

      @Override
      public double value(final double[] point) throws FunctionEvaluationException, IllegalArgumentException {
        final int n = point.length;
        final Double[] coordinate = new Double[n];
        for (int i = 0; i < n; i++) {
          coordinate[i] = point[i];
        }
        return f.evaluate(coordinate);
      }
    };
  }

  private  CommonsMathWrapper();

}