Class ADI2DStencilBuilder
java.lang.Object
net.finmath.finitedifference.solvers.adi.ADI2DStencilBuilder
Builds tridiagonal line matrices and exact directional operator actions
for alternating direction implicit (ADI) solves for two-dimensional
finite difference models.
The state variables are interpreted generically as
- state variable 0: first spatial direction,
- state variable 1: second spatial direction.
The PDE operator is split into the directional parts
A1: drift and diffusion terms in the first spatial direction.A2: drift and diffusion terms in the second spatial direction.
This builder returns tridiagonal matrices corresponding to
(I - theta * dt * A1) (I - theta * dt * A2)
and also provides exact applications of A1 and A2 to a
flattened 2D state vector using the same coefficients.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCoefficients of the 1D three-point stencil -
Constructor Summary
ConstructorsConstructorDescriptionADI2DStencilBuilder(FiniteDifferenceEquityModel model, double[] x0Grid, double[] x1Grid) Performs the operation. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]applyFirstDirectionOperator(double[] u, double time) Performs the operation.voidapplyFirstDirectionOperatorOnSlice(double[] u, double[] out, double time, int x1Index) Performs the operation.double[]applySecondDirectionOperator(double[] u, double time) Performs the operation.voidapplySecondDirectionOperatorOnSlice(double[] u, double[] out, double time, int x0Index) Performs the operation.buildFirstDirectionLineMatrix(double time, double dt, double theta, int x1Index) Performs the operation.buildSecondDirectionLineMatrix(double time, double dt, double theta, int x0Index) Performs the operation.getFirstDirectionCoefficients(double time, int x0Index, int x1Index) Returns the value.getSecondDirectionCoefficients(double time, int x0Index, int x1Index) Returns the value.
-
Constructor Details
-
ADI2DStencilBuilder
Performs the operation.- Parameters:
model- The value.x0Grid- The value.x1Grid- The value.
-
-
Method Details
-
buildFirstDirectionLineMatrix
public TridiagonalMatrix buildFirstDirectionLineMatrix(double time, double dt, double theta, int x1Index) Performs the operation.- Parameters:
time- The value.dt- The value.theta- The value.x1Index- The value.- Returns:
- The value.
-
buildSecondDirectionLineMatrix
public TridiagonalMatrix buildSecondDirectionLineMatrix(double time, double dt, double theta, int x0Index) Performs the operation.- Parameters:
time- The value.dt- The value.theta- The value.x0Index- The value.- Returns:
- The value.
-
applyFirstDirectionOperator
public double[] applyFirstDirectionOperator(double[] u, double time) Performs the operation.- Parameters:
u- The value.time- The value.- Returns:
- The value.
-
applySecondDirectionOperator
public double[] applySecondDirectionOperator(double[] u, double time) Performs the operation.- Parameters:
u- The value.time- The value.- Returns:
- The value.
-
applyFirstDirectionOperatorOnSlice
public void applyFirstDirectionOperatorOnSlice(double[] u, double[] out, double time, int x1Index) Performs the operation.- Parameters:
u- The value.out- The value.time- The value.x1Index- The value.
-
applySecondDirectionOperatorOnSlice
public void applySecondDirectionOperatorOnSlice(double[] u, double[] out, double time, int x0Index) Performs the operation.- Parameters:
u- The value.out- The value.time- The value.x0Index- The value.
-
getFirstDirectionCoefficients
public ADI2DStencilBuilder.DirectionalCoefficients getFirstDirectionCoefficients(double time, int x0Index, int x1Index) Returns the value.- Parameters:
time- The value.x0Index- The value.x1Index- The value.- Returns:
- The value.
-
getSecondDirectionCoefficients
public ADI2DStencilBuilder.DirectionalCoefficients getSecondDirectionCoefficients(double time, int x0Index, int x1Index) Returns the value.- Parameters:
time- The value.x0Index- The value.x1Index- The value.- Returns:
- The value.
-