Package com.opengamma.analytics.math.interpolation

Examples of com.opengamma.analytics.math.interpolation.PSplineFitter.solve()


      x.add(k[i]);
      y.add(vols[i]);
      sigma.add(1e-5);
    }
    final PSplineFitter pfitter = new PSplineFitter();
    final GeneralizedLeastSquareResults<Double> temp = pfitter.solve(x, y, sigma, 0.5, 1.7, 50, 3, 100000000, 2);
    final Function1D<Double, Double> func3 = temp.getFunction();

    for (int i = 0; i < 101; i++) {
      final double strike = 0.5 + 1.0 * i / 100.;
      System.out.println(strike + "\t" + func.evaluate(strike) + "\t" + func2.evaluate(strike) + "\t" + func3.evaluate(strike));
View Full Code Here


  @Test
  public void testPSplineFit2D() {

    final PSplineFitter psf = new PSplineFitter();
    final GeneralizedLeastSquareResults<double[]> results = psf.solve(X_COS_EXP, Y_COS_EXP, SIGMA_COS_EXP, new double[] {0.0, 0.0 }, new double[] {10.0, 10.0 }, new int[] {10, 10 },
        new int[] {3, 3 },
        new double[] {0.001, 0.001 }, new int[] {3, 3 });

    assertEquals(0.0, results.getChiSq(), 1e-9);
    final Function1D<double[], Double> spline = results.getFunction();
View Full Code Here

    final int[] degree = new int[] {3, 3 };
    final int[] diff = new int[] {2, 2 };
    final double[] lambda = new double[] {0.1, 0.3 };

    final PSplineFitter splineFitter = new PSplineFitter();
    final GeneralizedLeastSquareResults<double[]> res = splineFitter.solve(tk, vols, sigmas, new double[] {0.0, 0.0 }, new double[] {2.0, 3.0 }, nKnots, degree, lambda, diff);

    System.out.println(res.getChiSq());
    final Function1D<double[], Double> func = res.getFunction();

    final Function<Double, Double> temp2 = new Function<Double, Double>() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.