MultipleYieldCurveFinderFunction extends Function1D<DoubleMatrix1D, DoubleMatrix1D> { @Override public DoubleMatrix1D evaluate(final DoubleMatrix1D x) { final YieldCurveBundle curves = _curveBuilderFunction.evaluate(x); final YieldCurveBundle knownCurves = _data.getKnownCurves(); if (knownCurves != null) { curves.addAll(knownCurves); } final double[] res = new double[_data.getNumInstruments()]; for (int i = 0; i < _data.getNumInstruments(); i++) { res[i] = _data.getDerivative(i).accept(_calculator, curves) - _data.getMarketValue(i); } return new DoubleMatrix1D(res); } MultipleYieldCurveFinderFunction(final MultipleYieldCurveFinderDataBundle data, final InstrumentDerivativeVisitor<YieldCurveBundle, Double> calculator); @Override DoubleMatrix1D evaluate(final DoubleMatrix1D x);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullVector() { FINDER.evaluate((DoubleMatrix1D) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testMismatchingVector() { FINDER.evaluate(new DoubleMatrix1D(new double[] {1, 2, 3, 4, 5, 6, 7, 8})); }
@Test public void test() { final DoubleMatrix1D results = FINDER.evaluate(new DoubleMatrix1D(CONTINUOUS_RATES)); for (final double r : results.getData()) { assertEquals(0.0, r, 1e-14); } }