Class RatePseudoRootJacobian
The derivative of a log-normal Euler step's end rates along given bumps of its pseudo-root, analytically, for the pathwise vegas (Giles and Glasserman's B, a row per bump): the step in the discretely compounding money-market account.
[WorkingType]
public sealed class RatePseudoRootJacobian
- Inheritance
-
RatePseudoRootJacobian
- Inherited Members
Remarks
A working type: its scratch is QuantLib's members, so an instance serves one caller at a time. It copies the pseudo-root and the bumps.
The derivative (a documented divergence; Divergences/RatePseudoRootJacobianTests.cs): the drift's sum
carries each rate's own accrual period, e_j = Σ_{k<j} τ_k (f_k + d_k) P_k a_k, and the derivative of rate j along
rate k's root carries f_j + d_j. QuantLib's sums the terms without τ_k and multiplies by τ_j, right on equal periods
only, and carries f_j (ratepseudorootjacobian.cpp:183, :191, :197). On equal periods of a power
of two and no displacement, QuantLib's bits.
Constructors
RatePseudoRootJacobian(Matrix, int, int, ReadOnlySpan<double>, IReadOnlyList<Matrix>, ReadOnlySpan<double>)
Initializes a new instance of the RatePseudoRootJacobian class.
public RatePseudoRootJacobian(Matrix pseudoRoot, int aliveIndex, int numeraire, ReadOnlySpan<double> taus, IReadOnlyList<Matrix> pseudoBumps, ReadOnlySpan<double> displacements)
Parameters
pseudoRootMatrixThe step's pseudo-root, a row per rate; copied.
aliveIndexintThe step's first alive rate.
numeraireintThe step's numeraire: its first alive rate, the money-market account's.
tausReadOnlySpan<double>The rates' accrual periods.
pseudoBumpsIReadOnlyList<Matrix>The bumps, each of the pseudo-root's size; copied.
displacementsReadOnlySpan<double>The rates' displacements.
Exceptions
- ArgumentException
The numeraire isn't the first alive rate, or a size isn't the rates' or the factors'.
Methods
GetBumps(ReadOnlySpan<double>, ReadOnlySpan<double>, ReadOnlySpan<double>, ReadOnlySpan<double>, Matrix)
Writes, for each bump, the derivative of each rate at the step's end along the bump.
public void GetBumps(ReadOnlySpan<double> oldRates, ReadOnlySpan<double> discountRatios, ReadOnlySpan<double> newRates, ReadOnlySpan<double> gaussians, Matrix b)
Parameters
oldRatesReadOnlySpan<double>The rates at the step's start.
discountRatiosReadOnlySpan<double>The one-step discount factors at the step's start, 1 / (1 + τ_k f_k) at k + 1, 1 + the number of rates entries.
newRatesReadOnlySpan<double>The rates at the step's end.
gaussiansReadOnlySpan<double>The step's Gaussians, one per factor.
bMatrixThe derivatives, a row per bump and a column per rate, written.
Exceptions
- ArgumentException
bisn't the bumps' by the rates.