TwoStateMarkovChainWithLocalVolDensity { PDEFullResults1D[] solve(final PDEGrid1D grid) { final BoundaryCondition lower = new NeumannBoundaryCondition(0.0, grid.getSpaceNode(0), true); final BoundaryCondition upper = new DirichletBoundaryCondition(0.0, grid.getSpaceNode(grid.getNumSpaceNodes() - 1)); final ExtendedCoupledFiniteDifference solver = new ExtendedCoupledFiniteDifference(THETA); final PDEResults1D[] res = solver.solve(_data1, _data2, grid, lower, upper, lower, upper, null); final PDEFullResults1D res1 = (PDEFullResults1D) res[0]; final PDEFullResults1D res2 = (PDEFullResults1D) res[1]; return new PDEFullResults1D[] {res1, res2 }; } TwoStateMarkovChainWithLocalVolDensity(final ForwardCurve forward, final TwoStateMarkovChainDataBundle data, final AbsoluteLocalVolatilitySurface localVolOverlay);   }
@Test(enabled = false) public void test() { final double t = 5.0; final int tNodes = 50; final int xNodes = 100; final MeshingFunction timeMesh = new ExponentialMeshing(0, t, tNodes, 2.0); final MeshingFunction spaceMesh = new HyperbolicMeshing(0, 6.0 * FORWARD_CURVE.getForward(t), FORWARD_CURVE.getSpot(), xNodes, 0.01); final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh); final TwoStateMarkovChainWithLocalVolDensity densityCal = new TwoStateMarkovChainWithLocalVolDensity(FORWARD_CURVE, DATA, new AbsoluteLocalVolatilitySurface(ConstantDoublesSurface.from(1.0))); final PDEFullResults1D[] denRes = densityCal.solve(grid); System.out.println("Densities "); PDEUtilityTools.printSurface("state 1 density", denRes[0]); PDEUtilityTools.printSurface("state 2 density", denRes[1]); }