Class FDMThetaMethod2D
- All Implemented Interfaces:
FDMSolver
This solver assumes the two state variables (X0, X1) follow a generic
SDE
dX_i(t) = mu_i(t, X0, X1) dt + sum_k b_{i,k}(t, X0, X1) dW_k(t), i =
0,1.
It builds the backward PDE operator using
- Drift:
sum_i mu_i * d/dx_i - Diffusion:
0.5 * sum_{i,j} a_{i,j} * d^2/(dx_i dx_j)witha = b b^T - Discounting:
-r(t) * u
Boundary conditions are enforced via explicit BoundaryCondition
objects.
Dirichlet rows are overwritten only if the corresponding boundary condition
is of Dirichlet type.
If the boundary condition type is NONE, the PDE row is left intact.
In addition, products may define internal state constraints through
FiniteDifferenceInternalStateConstraint. Constrained nodes are
imposed
as internal Dirichlet rows.
For American exercise, the solver formulates each backward step as a linear complementarity problem and solves it with projected SOR. For non-American exercise, a direct linear solve is used.
The solver returns the full time history as a flattened matrix of dimension
(n0*n1) x (nT+1).
Flattening convention: k = i0 + i1*n0 where i0 is the fastest
index.
- Author:
- Enrico De Vecchi, Alessandro Gnoatto
-
Constructor Summary
ConstructorsConstructorDescriptionFDMThetaMethod2D(net.finmath.finitedifference.assetderivativevaluation.models.FiniteDifferenceEquityModel model, net.finmath.finitedifference.assetderivativevaluation.products.FiniteDifferenceEquityProduct product, net.finmath.finitedifference.grids.SpaceTimeDiscretization spaceTimeDiscretization, Exercise exercise) Creates a two-dimensional theta-method finite-difference solver. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]getValue(double evaluationTime, double time, DoubleBinaryOperator valueAtMaturity) Returns the flattened value vector at a given evaluation time for a genuinely two-dimensional payoff.double[]getValue(double evaluationTime, double time, DoubleUnaryOperator valueAtMaturity) Returns the flattened value vector at a given evaluation time for a payoff that depends only on the first state variable.double[][]getValues(double time, DoubleBinaryOperator valueAtMaturity) Solves the backward PDE on the full two-dimensional space-time grid.double[][]getValues(double time, DoubleUnaryOperator valueAtMaturity) Solves the PDE using a payoff that depends only on the first state variable.
-
Constructor Details
-
FDMThetaMethod2D
public FDMThetaMethod2D(net.finmath.finitedifference.assetderivativevaluation.models.FiniteDifferenceEquityModel model, net.finmath.finitedifference.assetderivativevaluation.products.FiniteDifferenceEquityProduct product, net.finmath.finitedifference.grids.SpaceTimeDiscretization spaceTimeDiscretization, Exercise exercise) Creates a two-dimensional theta-method finite-difference solver.- Parameters:
model- The finite-difference equity model providing drift, factor loadings, discounting, and boundary conditions.product- The product to be valued. It may optionally implementFiniteDifferenceInternalStateConstraint.spaceTimeDiscretization- The joint space-time discretization, including both spatial grids and the theta parameter.exercise- The exercise specification controlling whether and when exercise is allowed.
-
-
Method Details
-
getValues
Solves the PDE using a payoff that depends only on the first state variable.This overload promotes the one-dimensional terminal payoff into a two- dimensional one by ignoring the second state variable.
-
getValues
Solves the backward PDE on the full two-dimensional space-time grid.The returned matrix is indexed as
values[flattenedSpaceIndex][timeIndex]. The first column corresponds to maturity and subsequent columns correspond to earlier times in backward time-stepping order.At each time step, the method
- builds model coefficients at the two theta evaluation times,
- assembles the left- and right-hand-side theta operators,
- enforces outer boundary conditions and internal constraints,
- solves either a linear system or a linear complementarity problem,
- reimposes constraints and Dirichlet boundaries for numerical safety.
- Specified by:
getValuesin interfaceFDMSolver- Parameters:
time- The maturity time of the claim.valueAtMaturity- The terminal payoff as a function of both state variables.- Returns:
- The full flattened space-time solution surface.
- Throws:
IllegalArgumentException- If the discretization does not provide two spatial grids.
-
getValue
Returns the flattened value vector at a given evaluation time for a payoff that depends only on the first state variable.- Specified by:
getValuein interfaceFDMSolver- Parameters:
evaluationTime- The time at which the value is requested.time- The maturity time of the claim.valueAtMaturity- The terminal payoff as a function of the first state variable.- Returns:
- The flattened value vector at the requested evaluation time.
-
getValue
Returns the flattened value vector at a given evaluation time for a genuinely two-dimensional payoff.- Specified by:
getValuein interfaceFDMSolver- Parameters:
evaluationTime- The time at which the value is requested.time- The maturity time of the claim.valueAtMaturity- The terminal payoff as a function of both state variables.- Returns:
- The flattened value vector at the requested evaluation time.
-