Class ForwardForwardMappings
The mappings between forward rates of a multiple tenor and the forward rates of the curve state's: the Jacobian of the long forwards in the short ones, the Y matrix that switches a model's base from short to long forwards, and the curve state restricted to the long forwards' times.
public static class ForwardForwardMappings
- Inheritance
-
ForwardForwardMappings
- Inherited Members
Remarks
The k-th long forward runs from rate time offset + k × multiplier over multiplier short forwards. QuantLib's
Jacobian is 1/τ_long minus the long forward's derivative, and its Y matrix's long forward the negative of g/(1 + τ_long
g); both are fixed here (Divergences/ForwardForwardMappingsTests.cs): the derivative (P_start/P_end) τ_m
(P_{m+1}/P_m)/τ_long, and the long forward (P_start/P_end − 1)/τ_long, QuantLib's own
RestrictCurveState(CurveState, int, int) forward, which central bumps of it check. A multiplier or an offset QuantLib's
unsigned arithmetic wraps to an endless allocation (an offset past the rates) is refused.
Methods
ForwardForwardJacobian(CurveState, int, int)
The Jacobian dgᵢ/dfⱼ of the long forwards in the short ones.
public static Matrix ForwardForwardJacobian(CurveState cs, int multiplier, int offset)
Parameters
csCurveStateThe curve state, set from the first rate.
multiplierintThe short forwards each long one spans.
offsetintThe first long forward's first short one, below the multiplier and at most the rates.
Returns
- Matrix
A new matrix, long forwards by short ones.
Exceptions
- ArgumentException
The offset isn't below the multiplier.
- ArgumentOutOfRangeException
The offset is negative or past the rates.
RestrictCurveState(CurveState, int, int)
The curve state on the long forwards' times: every multiplier-th rate time from the offset.
public static LMMCurveState RestrictCurveState(CurveState cs, int multiplier, int offset)
Parameters
csCurveStateThe curve state, set from the first rate.
multiplierintThe short forwards each long one spans.
offsetintThe first long forward's first short one, below the multiplier and at most the rates.
Returns
- LMMCurveState
A new state, set on the restricted discount ratios.
Exceptions
- ArgumentException
The offset isn't below the multiplier, or no long forward fits.
- ArgumentOutOfRangeException
The offset is negative or past the rates.
YMatrix(CurveState, ReadOnlySpan<double>, ReadOnlySpan<double>, int, int)
The Y matrix switching a model's base from short to long forwards: the Jacobian in displaced logs.
public static Matrix YMatrix(CurveState cs, ReadOnlySpan<double> shortDisplacements, ReadOnlySpan<double> longDisplacements, int multiplier, int offset)
Parameters
csCurveStateThe curve state, set from the first rate.
shortDisplacementsReadOnlySpan<double>The short forwards' displacements, one per rate.
longDisplacementsReadOnlySpan<double>The long forwards' displacements, one per long forward.
multiplierintThe short forwards each long one spans.
offsetintThe first long forward's first short one, below the multiplier and at most the rates.
Returns
- Matrix
A new matrix, long forwards by short ones.
Exceptions
- ArgumentException
The offset isn't below the multiplier, or a displacement count is wrong.
- ArgumentOutOfRangeException
The offset is negative or past the rates.