Class ActivatedBarrierTrace2D

java.lang.Object
net.finmath.finitedifference.solvers.adi.ActivatedBarrierTrace2D

public final class ActivatedBarrierTrace2D extends Object
Immutable container for the activated post-hit value traced along the barrier as a function of the second state variable and time.

The intended usage is the direct 2D knock-in formulation: first solve the activated vanilla problem, then extract its value on the barrier and use that trace as interface data for the pre-hit PDE.

The data layout is values[secondIndex][timeIndex].

Author:
Alessandro Gnoatto
  • Constructor Details

    • ActivatedBarrierTrace2D

      public ActivatedBarrierTrace2D(double barrierValue, double[] secondStateGrid, TimeDiscretization timeGrid, double[][] values)
      Creates an immutable barrier trace container.
      Parameters:
      barrierValue - The barrier level in the first state variable.
      secondStateGrid - The grid of the second state variable.
      timeGrid - The time discretization corresponding to the trace values.
      values - Trace values with layout values[secondIndex][timeIndex].
  • Method Details

    • getBarrierValue

      public double getBarrierValue()
      Returns the barrier level.
      Returns:
      The barrier value.
    • getSecondStateGrid

      public double[] getSecondStateGrid()
      Returns a defensive copy of the second-state grid.
      Returns:
      The second-state grid.
    • getTimeGrid

      public TimeDiscretization getTimeGrid()
      Returns the time grid.
      Returns:
      The time discretization.
    • getValues

      public double[][] getValues()
      Returns a defensive deep copy of the stored trace values.
      Returns:
      The full trace matrix with layout values[secondIndex][timeIndex].
    • getValue

      public double getValue(int secondIndex, int timeIndex)
      Returns the stored value for a given second-state row and time index.
      Parameters:
      secondIndex - The second-state index.
      timeIndex - The time index.
      Returns:
      The trace value.
    • getValue

      public double getValue(int secondIndex, double tau)
      Returns the trace value for a given second-state row and time.

      If tau lies exactly on a time node, that node value is returned. Otherwise linear interpolation in time is used between the enclosing nodes. Values outside the grid are clamped to the nearest endpoint.

      Parameters:
      secondIndex - The second-state index.
      tau - The time coordinate.
      Returns:
      The interpolated trace value.
    • getNumberOfSecondStatePoints

      public int getNumberOfSecondStatePoints()
      Returns the number of second-state rows.
      Returns:
      The number of second-state grid points.
    • getNumberOfTimePoints

      public int getNumberOfTimePoints()
      Returns the number of time nodes.
      Returns:
      The number of time points.