Class FdmZabrOp
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
The ZABR pricing operator on a mesher whose first direction is the forward F and second the volatility v: ½v²F2β·∂²/∂F² + ½ν²v2γ·∂²/∂v² + νρ|v|γ+1Fβ·∂²/∂F∂v; γ = 1 is SABR.
[Experimental("NQL0001")]
[WorkingType]
public sealed class FdmZabrOp : FdmLinearOpComposite
- Inheritance
-
FdmZabrOp
- Inherited Members
Remarks
A working type: its bands are built at construction and never change, and the sum Apply(ReadOnlySpan<double>, Span<double>) forms is written through buffers it holds, so a step allocates nothing; not thread-safe. Experimental, as in QuantLib.
Constructors
FdmZabrOp(FdmMesher, double, double, double, double)
Initializes a new instance of the FdmZabrOp class.
public FdmZabrOp(FdmMesher mesher, double beta, double nu, double rho, double gamma = 1)
Parameters
mesherFdmMesherThe mesher: the forward, then the volatility.
betadoubleβ.
nudoubleν.
rhodoubleρ.
gammadoubleγ; 1 recovers the classic SABR model.
Exceptions
- ArgumentNullException
mesheris null.
Properties
Size
Gets the number of directions.
public override int Size { get; }
Property Value
Methods
Apply(ReadOnlySpan<double>, Span<double>)
Applies the operator to r, writing the result into the caller's span.
public override void Apply(ReadOnlySpan<double> r, Span<double> result)
Parameters
rReadOnlySpan<double>The values, one per point.
resultSpan<double>The result, of
r's length; it mustn't overlapr.
ApplyDirection(int, ReadOnlySpan<double>, Span<double>)
Applies the operator's part in one direction, writing the result into the caller's span.
public override void ApplyDirection(int direction, ReadOnlySpan<double> r, Span<double> result)
Parameters
directionintThe direction.
rReadOnlySpan<double>The values, one per point.
resultSpan<double>The result, of
r's length.
Exceptions
- ArgumentOutOfRangeException
directionis neither 0 nor 1.
ApplyMixed(ReadOnlySpan<double>, Span<double>)
Applies the operator's mixed part, writing the result into the caller's span.
public override void ApplyMixed(ReadOnlySpan<double> r, Span<double> result)
Parameters
rReadOnlySpan<double>The values, one per point.
resultSpan<double>The result, of
r's length.
Preconditioner(ReadOnlySpan<double>, double, Span<double>)
Applies the preconditioner of (1 + s·A), writing the result into the caller's
span.
public override void Preconditioner(ReadOnlySpan<double> r, double s, Span<double> result)
Parameters
rReadOnlySpan<double>The values, one per point.
sdoubleThe scale of the operator.
resultSpan<double>The result, of
r's length.
SetTime(double, double)
Sets the operator for the interval [t1, t2].
public override void SetTime(double t1, double t2)
Parameters
SolveSplitting(int, ReadOnlySpan<double>, double, Span<double>)
Solves (1 + s·Adirection) x = r for x, writing it into the
caller's span.
public override void SolveSplitting(int direction, ReadOnlySpan<double> r, double s, Span<double> result)
Parameters
directionintThe direction.
rReadOnlySpan<double>The right-hand side, one value per point.
sdoubleThe scale of the direction's operator.
resultSpan<double>The solution, of
r's length.
Exceptions
- ArgumentOutOfRangeException
directionis neither 0 nor 1.
ToMatrixDecomp()
The operator as sparse matrices, one per part.
public override ImmutableArray<SparseMatrix> ToMatrixDecomp()
Returns
- ImmutableArray<SparseMatrix>
The matrices.
Exceptions
- NanoQLException
The operator has no sparse representation.