Class FDMBarrierHestonADI2D

java.lang.Object
net.finmath.finitedifference.solvers.adi.AbstractADI2D
net.finmath.finitedifference.solvers.adi.FDMBarrierHestonADI2D
All Implemented Interfaces:
FDMSolver

public class FDMBarrierHestonADI2D extends AbstractADI2D
Barrier-aware ADI finite difference solver for the two-dimensional Heston PDE.

This class supports:

In pre-hit mode, the barrier is treated as an interface on the first state variable (spot) and the activated post-hit value is injected through an ActivatedBarrierTrace2D. The exercise obstacle is intentionally disabled in that mode.

Author:
Alessandro Gnoatto
  • Constructor Details

    • FDMBarrierHestonADI2D

      public FDMBarrierHestonADI2D(FDMHestonModel model, FiniteDifferenceEquityProduct product, SpaceTimeDiscretization spaceTimeDiscretization, Exercise exercise, BarrierPDEMode barrierMode, BarrierPreHitSpecification preHitSpecification)
      Creates the barrier-aware Heston ADI solver.
      Parameters:
      model - The Heston model.
      product - The finite-difference product.
      spaceTimeDiscretization - The discretization to use.
      exercise - The exercise specification.
      barrierMode - The barrier PDE mode.
      preHitSpecification - The pre-hit specification. Required in IN_PRE_HIT mode.
  • Method Details

    • getValues

      public double[][] getValues(double time, DoubleUnaryOperator valueAtMaturity)
      Description copied from class: AbstractADI2D
      Returns the full value surface for a terminal payoff depending on the first state variable.
      Specified by:
      getValues in interface FDMSolver
      Overrides:
      getValues in class AbstractADI2D
      Parameters:
      time - Maturity time.
      valueAtMaturity - Terminal payoff.
      Returns:
      Value surface indexed by flattened space index and time index.
    • getValues

      public double[][] getValues(double time, DoubleBinaryOperator valueAtMaturity)
      Description copied from class: AbstractADI2D
      Returns the full value surface for a two-dimensional terminal payoff.
      Specified by:
      getValues in interface FDMSolver
      Overrides:
      getValues in class AbstractADI2D
      Parameters:
      time - Maturity time.
      valueAtMaturity - Terminal payoff.
      Returns:
      Value surface indexed by flattened space index and time index.
    • getValues

      public double[][] getValues(double time, DoubleBinaryOperator valueAtMaturity, AbstractADI2D.DoubleTernaryOperator exerciseValue)
      Description copied from class: AbstractADI2D
      Returns the full value surface under a discrete exercise obstacle.
      Overrides:
      getValues in class AbstractADI2D
      Parameters:
      time - Maturity time.
      valueAtMaturity - Terminal payoff.
      exerciseValue - Exercise payoff.
      Returns:
      Value surface indexed by flattened space index and time index.
    • solveFirstDirectionLines

      protected double[] solveFirstDirectionLines(double[] rhs, double time, double dt)
      Overrides:
      solveFirstDirectionLines in class AbstractADI2D
    • applyOuterBoundaries

      protected void applyOuterBoundaries(double time, double[] u)
      Overrides:
      applyOuterBoundaries in class AbstractADI2D
    • isPreHitMode

      protected boolean isPreHitMode()
      Returns true if this solver is in pre-hit continuation mode.
      Returns:
      True if in pre-hit mode.
    • overwriteBarrierTraceRow

      protected void overwriteBarrierTraceRow(TridiagonalMatrix matrix, double[] rhs, int secondIndex, double runningTime)
      Overwrites the barrier interface row in a first-direction tridiagonal system.
      Parameters:
      matrix - The tridiagonal matrix.
      rhs - The corresponding right-hand side.
      secondIndex - The variance index.
      runningTime - The running time.
    • applyBarrierTraceIfNeeded

      protected void applyBarrierTraceIfNeeded(double runningTime, double[] u)
      Applies the barrier trace directly to the flattened solution vector.
      Parameters:
      runningTime - The running time.
      u - The solution vector.
    • getBarrierTraceValue

      protected double getBarrierTraceValue(int secondIndex, double runningTime)
      Returns the activated barrier trace value at the given variance row and running time.
      Parameters:
      secondIndex - The variance index.
      runningTime - The running time.
      Returns:
      The corresponding trace value.
    • getHestonModel

      public FDMHestonModel getHestonModel()
      Returns the Heston model used by this solver.
      Returns:
      The Heston model.
    • getBarrierMode

      public BarrierPDEMode getBarrierMode()
      Returns the barrier PDE mode.
      Returns:
      The barrier mode.
    • getPreHitSpecification

      public BarrierPreHitSpecification getPreHitSpecification()
      Returns the pre-hit specification, or null if not in pre-hit mode.
      Returns:
      The pre-hit specification.