RadialBasisFunctionInterpolatorND extends InterpolatorND { @Override public Double interpolate(final InterpolatorNDDataBundle data, final double[] x) { validateInput(data, x); ArgumentChecker.isTrue(data instanceof RadialBasisFunctionInterpolatorDataBundle, "RadialBasisFunctionInterpolatorND needs a RadialBasisFunctionInterpolatorDataBundle"); final RadialBasisFunctionInterpolatorDataBundle radialData = (RadialBasisFunctionInterpolatorDataBundle) data; final List<Pair<double[], Double>> rawData = radialData.getData(); final double[] w = radialData.getWeights(); final Function1D<Double, Double> basisFunction = radialData.getBasisFunction(); final int n = rawData.size(); double sum = 0; double normSum = 0; double[] xi; double phi; for (int i = 0; i < n; i++) { xi = rawData.get(i).getFirst(); phi = basisFunction.evaluate(DistanceCalculator.getDistance(x, xi)); sum += w[i] * phi; normSum += phi; } return radialData.isNormalized() ? sum / normSum : sum; } RadialBasisFunctionInterpolatorND(final Function1D<Double, Double> basisFunction, final boolean useNormalized); @Override Double interpolate(final InterpolatorNDDataBundle data, final double[] x); @Override Map<double[], Double> getNodeSensitivitiesForValue(final InterpolatorNDDataBundle data, final double[] x); @Override RadialBasisFunctionInterpolatorDataBundle getDataBundle(final double[] x, final double[] y, final double[] z, final double[] values); @Override RadialBasisFunctionInterpolatorDataBundle getDataBundle(final List<Pair<double[], Double>> data); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { INTERPOLATOR.interpolate(null, new double[] {1, 2}); }