KrigingInterpolatorND extends InterpolatorND { @Override public Double interpolate(final InterpolatorNDDataBundle data, final double[] x) { validateInput(data, x); Validate.isTrue(data instanceof KrigingInterpolatorDataBundle, "KriginInterpolatorND needs a KriginInterpolatorDataBundle"); KrigingInterpolatorDataBundle krigingData = (KrigingInterpolatorDataBundle) data; final List<Pair<double[], Double>> rawData = krigingData.getData(); final Function1D<Double, Double> variogram = krigingData.getVariogram(); final double[] w = krigingData.getWeights(); final int n = rawData.size(); double sum = 0.0; double r; for (int i = 0; i < n; i++) { r = DistanceCalculator.getDistance(x, rawData.get(i).getFirst()); sum += variogram.evaluate(r) * w[i]; } sum += w[n]; return sum; } KrigingInterpolatorND(final double beta); @Override Double interpolate(final InterpolatorNDDataBundle data, final double[] x); @Override KrigingInterpolatorDataBundle getDataBundle(final double[] x, final double[] y, final double[] z, final double[] values); @Override KrigingInterpolatorDataBundle 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}); }