ShepardInterpolatorND extends InterpolatorND { @Override public Double interpolate(final InterpolatorNDDataBundle data, final double[] x) { validateInput(data, x); final List<Pair<double[], Double>> rawData = data.getData(); final int n = rawData.size(); double sum = 0; double normSum = 0; double[] xi; double yi; double phi; double dist; Pair<double[], Double> temp; for (int i = 0; i < n; i++) { temp = rawData.get(i); xi = temp.getFirst(); yi = temp.getSecond(); dist = DistanceCalculator.getDistance(x, xi); if (dist == 0.0) { return yi; } phi = _basisFunction.evaluate(dist); sum += yi * phi; normSum += phi; } return sum / normSum; } ShepardInterpolatorND(final double power); @Override Double interpolate(final InterpolatorNDDataBundle data, final double[] x); @Override InterpolatorNDDataBundle getDataBundle(final double[] x, final double[] y, final double[] z, final double[] values); @Override InterpolatorNDDataBundle getDataBundle(final List<Pair<double[], Double>> data);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { INTERPOLATOR.interpolate(null, new double[] {1, 2}); }