Table of Contents

Class FdmCEVOp

Namespace
NanoQL.Methods
Assembly
NanoQL.dll

The backward operator of the constant elasticity of variance (CEV) process df = α·f^β·dW, absorbed at f = 0, in one direction of a mesher: the diffusion ½α²f^{2β}, discounting at the curve's forward rate.

[WorkingType]
public sealed class FdmCEVOp : FdmLinearOpComposite
Inheritance
FdmCEVOp
Inherited Members

Remarks

A working type: SetTime(double, double) rewrites the step's operator in place through a buffer it holds, and the apply and splitting solves write into the caller's spans, so a step allocates nothing. The forward rate is the curve's over its own times, read through YieldTermStructure's internal ContinuousForwardRate, its bits ForwardRate's.

The second derivative is taken in the direction given, where QuantLib's is built on direction 0 whatever the direction (fdmcevop.cpp:39-40), so that in another direction of a mesher of more than one it differentiates along the wrong axis: QuantLib's operator in direction 1 of a two-dimensional mesher differs from its operator in direction 0 of the transposed mesher. In direction 0, QuantLib's bits.

Constructors

FdmCEVOp(FdmMesher, YieldTermStructure, double, double, double, int)

Initializes a new instance of the FdmCEVOp class.

public FdmCEVOp(FdmMesher mesher, YieldTermStructure rTS, double f0, double alpha, double beta, int direction)

Parameters

mesher FdmMesher

The mesher.

rTS YieldTermStructure

The discount curve.

f0 double

The forward's value today, which QuantLib's operator doesn't read.

alpha double

The volatility parameter α.

beta double

The elasticity β.

direction int

The forward's direction.

Exceptions

ArgumentNullException

The mesher or the curve is null.

ArgumentOutOfRangeException

The direction isn't one of the layout's.

Properties

Size

Gets the number of directions.

public override int Size { get; }

Property Value

int

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

r ReadOnlySpan<double>

The values, one per point.

result Span<double>

The result, of r's length; it mustn't overlap r.

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

direction int

The direction.

r ReadOnlySpan<double>

The values, one per point.

result Span<double>

The result, of r's length.

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

r ReadOnlySpan<double>

The values, one per point.

result Span<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

r ReadOnlySpan<double>

The values, one per point.

s double

The scale of the operator.

result Span<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

t1 double

The start time.

t2 double

The end time, not before t1.

Exceptions

ArgumentException

t2 is before t1, or the curve can't be read between them.

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

direction int

The direction.

r ReadOnlySpan<double>

The right-hand side, one value per point.

s double

The scale of the direction's operator.

result Span<double>

The solution, of r's length.

Remarks

Another direction's solution is zero, as QuantLib's.

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.