@Test(enabled = false)
public void rootTest() {
final Interpolator1D baseInterpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(Interpolator1DFactory.DOUBLE_QUADRATIC, Interpolator1DFactory.LINEAR_EXTRAPOLATOR);
final NewtonDefaultVectorRootFinder rootFinder = new NewtonDefaultVectorRootFinder();
final Function1D<DoubleMatrix1D, DoubleMatrix1D> residualFunc = new Function1D<DoubleMatrix1D, DoubleMatrix1D>() {
@SuppressWarnings("synthetic-access")
@Override
public DoubleMatrix1D evaluate(final DoubleMatrix1D x) {
final InterpolatedDoublesCurve curve = new InterpolatedDoublesCurve(TENORS, x.getData(), baseInterpolator, true);
final DoubleMatrix1D modelRates = swapRateFunction.evaluate(curve);
return (DoubleMatrix1D) MA.subtract(new DoubleMatrix1D(RATES), modelRates);
}
};
final DoubleMatrix1D rootRes = rootFinder.getRoot(residualFunc, new DoubleMatrix1D(N_SWAPS, 0.03));
final InterpolatedDoublesCurve curve = new InterpolatedDoublesCurve(TENORS, rootRes.getData(), baseInterpolator, true);
System.out.println();
for (int i = 0; i < 101; i++) {
final double t = i * 20.0 / 100;