TransformedInterpolator1D extends Interpolator1D { @Override public Double interpolate(final Interpolator1DDataBundle data, final Double value) { return _transform.inverseTransform(_base.interpolate(data, value)); } TransformedInterpolator1D(final Interpolator1D baseInterpolator, final ParameterLimitsTransform transform); @Override Double interpolate(final Interpolator1DDataBundle data, final Double value); @Override double firstDerivative(final Interpolator1DDataBundle data, final Double value); @Override double[] getNodeSensitivitiesForValue(final Interpolator1DDataBundle data, final Double value); @Override Interpolator1DDataBundle getDataBundle(final double[] x, final double[] y); @Override Interpolator1DDataBundle getDataBundleFromSortedArrays(final double[] x, final double[] y);  }
@Test public void testCorrectAtNodes() { final int n = Y_DATA.length; for (int i = 0; i < n; i++) { double y = INTERPOLATOR.interpolate(TRANS_DATA_BUNDLE, X_DATA[i]); assertEquals(Y_DATA[i], y, 1e-12); } }
@Test public void testInRange() { for (int i = 0; i < 200; i++) { double x = 5.0 * i / 199.0; double y = INTERPOLATOR.interpolate(TRANS_DATA_BUNDLE, x); assertTrue(y >= 0 && y <= 1); } }
@Test(enabled = false) public void test() { System.out.println("TransformedInterpolator1DTest"); for (int i = 0; i < 200; i++) { double x = 5.0 * i / 199.0; System.out.println(x + "\t" + INTERPOLATOR_BASE.interpolate(DATA_BUNDLE, x) + "\t" + INTERPOLATOR.interpolate(TRANS_DATA_BUNDLE, x)+ "\t"+INTERPOLATOR.interpolate(DATA_BUNDLE, x)); } }