Interface FDMSolver

All Known Implementing Classes:
FDMThetaMethod1D, FDMThetaMethod1DJump, FDMThetaMethod1DTwoState, FDMThetaMethod2D

public interface FDMSolver
Interface for finite difference solvers.

Implementations provide methods to compute the solution of a PDE on a space-time grid, either at a specific evaluation time or over the full time history.

Author:
Alessandro Gnoatto
  • Method Summary

    Modifier and Type
    Method
    Description
    default double[]
    getValue(double evaluationTime, double time, double[] terminalValues)
    Returns the solution at a given evaluation time using a precomputed terminal value vector on the spatial grid.
    default double[]
    getValue(double evaluationTime, double time, double[] terminalValues, DoubleUnaryOperator exerciseValue)
    Default binary-payoff version with early exercise For solvers that are effectively 1D, the second state variable is ignored.
    default double[]
    getValue(double evaluationTime, double time, DoubleBinaryOperator valueAtMaturity)
    Default binary-payoff version.
    double[]
    getValue(double evaluationTime, double time, DoubleUnaryOperator valueAtMaturity)
    Returns the solution at a given evaluation time.
    default double[][]
    getValues(double time, double[] terminalValues)
    Returns the full time history of the solution using a precomputed terminal value vector on the spatial grid.
    default double[][]
    getValues(double time, double[] terminalValues, DoubleUnaryOperator exerciseValue)
    Default binary-payoff version with early exercise For solvers that are effectively 1D, the second state variable is ignored.
    default double[][]
    getValues(double time, DoubleBinaryOperator valueAtMaturity)
    Default binary-payoff version.
    double[][]
    getValues(double time, DoubleUnaryOperator valueAtMaturity)
    Returns the full time history of the solution on the space-time grid.
  • Method Details

    • getValue

      double[] getValue(double evaluationTime, double time, DoubleUnaryOperator valueAtMaturity)
      Returns the solution at a given evaluation time.

      This is a legacy return type. Typical shapes are:

      • 1D: [nS] representing values at the evaluation time.
      • 2D: [nS * nV] representing values at the evaluation time.
      Parameters:
      evaluationTime - The evaluation time.
      time - The maturity (time to maturity).
      valueAtMaturity - The payoff function applied at maturity.
      Returns:
      The solution at the specified evaluation time.
    • getValues

      double[][] getValues(double time, DoubleUnaryOperator valueAtMaturity)
      Returns the full time history of the solution on the space-time grid.

      Typical shapes are:

      • 1D: [nT][nS]
      • 2D: [nT][nS * nV]
      Parameters:
      time - The maturity (time to maturity).
      valueAtMaturity - The payoff function applied at maturity.
      Returns:
      The full time-space solution.
    • getValue

      default double[] getValue(double evaluationTime, double time, double[] terminalValues)
      Returns the solution at a given evaluation time using a precomputed terminal value vector on the spatial grid.

      This overload is useful for products that require a non-pointwise terminal initialization, for example cell-averaged digitals.

      The supplied array is interpreted as the maturity layer ordered consistently with the solver's spatial grid.

      Parameters:
      evaluationTime - The evaluation time.
      time - The maturity time.
      terminalValues - The terminal values on the spatial grid.
      Returns:
      The value vector at the requested evaluation time.
    • getValues

      default double[][] getValues(double time, double[] terminalValues)
      Returns the full time history of the solution using a precomputed terminal value vector on the spatial grid.

      This overload is useful for products that require a non-pointwise terminal initialization, for example cell-averaged digitals.

      Parameters:
      time - The maturity time.
      terminalValues - The terminal values on the spatial grid.
      Returns:
      The full time-space solution.
    • getValue

      default double[] getValue(double evaluationTime, double time, DoubleBinaryOperator valueAtMaturity)
      Default binary-payoff version. For solvers that are effectively 1D, the second state variable is ignored.
      Parameters:
      evaluationTime - The value.
      time - The value.
      valueAtMaturity - The value.
      Returns:
      The value.
    • getValues

      default double[][] getValues(double time, DoubleBinaryOperator valueAtMaturity)
      Default binary-payoff version. For solvers that are effectively 1D, the second state variable is ignored.
      Parameters:
      time - The value.
      valueAtMaturity - The value.
      Returns:
      The value.
    • getValue

      default double[] getValue(double evaluationTime, double time, double[] terminalValues, DoubleUnaryOperator exerciseValue)
      Default binary-payoff version with early exercise For solvers that are effectively 1D, the second state variable is ignored.
      Parameters:
      evaluationTime - The value.
      time - The value.
      terminalValues - The value.
      exerciseValue - The value.
      Returns:
      The value.
    • getValues

      default double[][] getValues(double time, double[] terminalValues, DoubleUnaryOperator exerciseValue)
      Default binary-payoff version with early exercise For solvers that are effectively 1D, the second state variable is ignored.
      Parameters:
      time - The value.
      terminalValues - The value.
      exerciseValue - The value.
      Returns:
      The value.