BarycentricRationalFunctionInterpolator1D extends Interpolator1D { @Override public Double interpolate(final Interpolator1DDataBundle data, final Double value) { Validate.notNull(value, "value"); Validate.notNull(data, "data bundle"); if (data.size() < _degree) { throw new MathException("Cannot interpolate " + data.size() + " data points with rational functions of degree " + _degree); } final int m = data.size(); final double[] x = data.getKeys(); final double[] y = data.getValues(); if (data.getLowerBoundIndex(value) == m - 1) { return y[m - 1]; } final double[] w = getWeights(x); final int n = x.length; double delta, temp, num = 0, den = 0; for (int i = 0; i < n; i++) { delta = value - x[i]; if (Math.abs(delta) < _eps) { return y[i]; } temp = w[i] / delta; num += temp * y[i]; den += temp; } return num / den; } BarycentricRationalFunctionInterpolator1D(final int degree, double eps); @Override Double interpolate(final Interpolator1DDataBundle data, final Double value); @Override Interpolator1DDataBundle getDataBundle(final double[] x, final double[] y); @Override Interpolator1DDataBundle getDataBundleFromSortedArrays(final double[] x, final double[] y); @Override boolean equals(final Object o); @Override int hashCode(); @Override double[] getNodeSensitivitiesForValue(Interpolator1DDataBundle data, Double value);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDataBundle() { INTERPOLATOR.interpolate(null, 2.); }