Examples of HyperbolicMeshing


Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

    } else {
      lower = new DirichletBoundaryCondition(0.0, minMoneyness);
      upper = new NeumannBoundaryCondition(1.0, maxMoneyness, false);
    }
    final MeshingFunction timeMesh = new ExponentialMeshing(0.0, maxT, nTimeSteps, timeMeshLambda);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(minMoneyness, maxMoneyness, centreMoneyness, nStrikeSteps, strikeMeshBunching);
    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);
    final Function1D<Double, Double> initialCond = (new InitialConditionsProvider()).getForwardCallPut(isCall);
    final PDEFullResults1D res = (PDEFullResults1D) solver.solve(new PDE1DDataBundle<>(pde, initialCond, lower, upper, grid));
    return res;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

  private MeshingFunction getTimeMesh(final double maxTime) {
    return new DoubleExponentialMeshing(0, maxTime, maxTime / 2, _nTimeSteps, _timeMeshLambda, -_timeMeshLambda);
  }

  private MeshingFunction getSpaceMesh(final double maxSpace, final double heart) {
    return new HyperbolicMeshing(0.0, maxSpace, heart, _nSpaceSteps, _spaceMeshBunching);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

  private MeshingFunction getTimeMesh(final double maxTime) {
    return new ExponentialMeshing(0.0, maxTime, _nTimeSteps, _timeMeshLambda);
  }

  private MeshingFunction getSpaceMesh(final double minMoneyness, final double maxMoneyness) {
    return new HyperbolicMeshing(minMoneyness, maxMoneyness, _centreMoneyness, _nSpaceSteps, _spaceMeshBunching);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

      throw new IllegalArgumentException("sd does not give boundaries that contain the strike. Use a minimum value of " + minSD);
    }

    // centre the nodes around the spot
    final double[] fixedPoints = k == 0.0 ? new double[] {s0} : new double[] {s0, k};
    final MeshingFunction xMesh = new HyperbolicMeshing(sMin, sMax, s0, spaceNodes, beta, fixedPoints);

    MeshingFunction tMesh = new ExponentialMeshing(0, t, timeNodes, lambda);
    final PDEGrid1D[] grid;
    final double[] theta;
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

    }

    //get the local vol of basic Markov chain model

    final MeshingFunction timeMesh = new ExponentialMeshing(0, tmaxT, tNodes, 2.0);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(0, 6.0 * forward.getForward(tmaxT), forward.getForward(0), xNodes, 0.01);
    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);

    final TwoStateMarkovChainWithLocalVolDensity densityCal = new TwoStateMarkovChainWithLocalVolDensity(forward, chainData, new AbsoluteLocalVolatilitySurface(ConstantDoublesSurface.from(1.0)));
    PDEFullResults1D[] denRes = densityCal.solve(grid);

View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

    final int tNodes = 20;
    final int xNodes = 100;

    //TODO remove hard coded grid
    final MeshingFunction timeMesh = new ExponentialMeshing(0, tmaxT, tNodes, 5.0);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(0, 10.0 * forward.getForward(maxT), forward.getSpot(), xNodes, 0.01);
    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);

    final Function1D<DoubleMatrix1D, DoubleMatrix1D> funcAppox = new Function1D<DoubleMatrix1D, DoubleMatrix1D>() {

      @SuppressWarnings("synthetic-access")
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

        upper = new DirichletBoundaryCondition(0.0, sMax);
      }
    }

    final MeshingFunction tMesh = new ExponentialMeshing(0, expiry, _nTNodes, _lambda);
    final MeshingFunction xMesh = new HyperbolicMeshing(sMin, sMax, spot, _nXNodes, _bunching);
    final PDEGrid1D grid = new PDEGrid1D(tMesh, xMesh);
    final PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients> pdeData = new PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients>(pde, intCon, lower, upper, grid);

    final PDEResults1D res = SOLVER.solve(pdeData);
    //for now just do linear interpolation on price. TODO replace this with something more robust
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

        upper = new DirichletBoundaryCondition(0.0, sMax);
      }
    }

    final MeshingFunction tMesh = new ExponentialMeshing(0, expiry, _nTNodes, _lambda);
    final MeshingFunction xMesh = new HyperbolicMeshing(sMin, sMax, spot, _nXNodes, _bunching);
    final PDEGrid1D grid = new PDEGrid1D(tMesh, xMesh);
    final PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients> pdeData = new PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients>(pde, intCon, lower, upper, grid);

    final PDEResults1D res = SOLVER.solve(pdeData);
    //for now just do linear interpolation on price. TODO replace this with something more robust
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

      lower = new DirichletBoundaryCondition(lowerValue, sMin);
      upper = new DirichletBoundaryCondition(0.0, sMax);
    }

    final MeshingFunction tMesh = new ExponentialMeshing(0, expiry, _nTNodes, _lambda);
    final MeshingFunction xMesh = new HyperbolicMeshing(sMin, sMax, spot, _nXNodes, _bunching);
    final PDEGrid1D grid = new PDEGrid1D(tMesh, xMesh);
    final PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients> pdeData = new PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients>(pde, intCon, lower, upper, grid);

    final PDEResults1D res = SOLVER.solve(pdeData);
    //for now just do linear interpolation on price. TODO replace this with something more robust
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

      throw new IllegalArgumentException("sd does not give boundaries that contain the strike. Use a minimum value of " + minSD);
    }

    // centre the nodes around the spot
    final double[] fixedPoints = k == 0.0 ? new double[] {s0} : new double[] {s0, k};
    final MeshingFunction xMesh = new HyperbolicMeshing(sMin, sMax, s0, spaceNodes, beta, fixedPoints);

    MeshingFunction tMesh = new ExponentialMeshing(0, t, timeNodes, lambda);
    final PDEGrid1D[] grid;
    final double[] theta;
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.