Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Attributes | List of all members
Lgm1fParametrization< TS > Class Template Referenceabstract

LGM 1F Parametrization. More...

#include <qle/models/irlgm1fparametrization.hpp>

+ Inheritance diagram for Lgm1fParametrization< TS >:
+ Collaboration diagram for Lgm1fParametrization< TS >:

Public Member Functions

 Lgm1fParametrization (const Currency &currency, const Handle< TS > &termStructure, const std::string &name=std::string())
 
virtual Real zeta (const Time t) const =0
 
virtual Real H (const Time t) const =0
 
virtual Real alpha (const Time t) const
 
virtual Real kappa (const Time t) const
 
virtual Real Hprime (const Time t) const
 
virtual Real Hprime2 (const Time t) const
 
virtual Real hullWhiteSigma (const Time t) const
 
const Handle< TS > termStructure () const
 
Real zetan (const Size n, const Time t, const QuantLib::ext::shared_ptr< Integrator > &integrator)
 
Real & shift ()
 
Real & scaling ()
 
Size numberOfParameters () const override
 
void update () const override
 
- Public Member Functions inherited from Parametrization
 Parametrization (const Currency &currency, const std::string &name="")
 
virtual ~Parametrization ()
 
virtual const Currency & currency () const
 
virtual const Array & parameterTimes (const Size) const
 
virtual Size numberOfParameters () const
 
virtual Array parameterValues (const Size) const
 
virtual const QuantLib::ext::shared_ptr< Parameter > parameter (const Size) const
 
virtual void update () const
 
const std::string & name () const
 
virtual Real direct (const Size, const Real x) const
 
virtual Real inverse (const Size, const Real y) const
 

Protected Attributes

Real shift_
 
Real scaling_
 
- Protected Attributes inherited from Parametrization
const Real h_
 
const Real h2_
 

Private Attributes

const Handle< TS > termStructure_
 
std::map< std::pair< Size, Real >, Real > zetan_cached_
 

Additional Inherited Members

- Protected Member Functions inherited from Parametrization
Time tr (const Time t) const
 
Time tl (const Time t) const
 
Time tr2 (const Time t) const
 
Time tm2 (const Time t) const
 
Time tl2 (const Time t) const
 

Detailed Description

template<class TS>
class QuantExt::Lgm1fParametrization< TS >

LGM 1F Parametrization.

Definition at line 40 of file irlgm1fparametrization.hpp.

Constructor & Destructor Documentation

◆ Lgm1fParametrization()

Lgm1fParametrization ( const Currency &  currency,
const Handle< TS > &  termStructure,
const std::string &  name = std::string() 
)

Definition at line 82 of file irlgm1fparametrization.hpp.

84 : Parametrization(currency, name.empty() ? currency.code() : name), shift_(0.0), scaling_(1.0),
const Handle< TS > termStructure() const
const std::string & name() const
virtual const Currency & currency() const
Parametrization(const Currency &currency, const std::string &name="")

Member Function Documentation

◆ zeta()

virtual Real zeta ( const Time  t) const
pure virtual

zeta must satisfy zeta(0) = 0, zeta'(t) >= 0

Implemented in Lgm1fConstantParametrization< TS >, Lgm1fPiecewiseConstantHullWhiteAdaptor< TS >, Lgm1fPiecewiseConstantParametrization< TS >, and Lgm1fPiecewiseLinearParametrization< TS >.

+ Here is the caller graph for this function:

◆ H()

virtual Real H ( const Time  t) const
pure virtual

H must be such that H' does not change its sign

Implemented in Lgm1fConstantParametrization< TS >, Lgm1fPiecewiseConstantHullWhiteAdaptor< TS >, Lgm1fPiecewiseConstantParametrization< TS >, and Lgm1fPiecewiseLinearParametrization< TS >.

+ Here is the caller graph for this function:

◆ alpha()

Real alpha ( const Time  t) const
virtual

◆ kappa()

Real kappa ( const Time  t) const
virtual

◆ Hprime()

Real Hprime ( const Time  t) const
virtual

◆ Hprime2()

Real Hprime2 ( const Time  t) const
virtual

◆ hullWhiteSigma()

Real hullWhiteSigma ( const Time  t) const
virtual

Reimplemented in Lgm1fPiecewiseConstantHullWhiteAdaptor< TS >.

Definition at line 101 of file irlgm1fparametrization.hpp.

101 {
102 return Hprime(t) * alpha(t);
103}
virtual Real alpha(const Time t) const
+ Here is the caller graph for this function:

◆ termStructure()

const Handle< TS > termStructure

Definition at line 107 of file irlgm1fparametrization.hpp.

107{ return termStructure_; }
+ Here is the caller graph for this function:

◆ zetan()

Real zetan ( const Size  n,
const Time  t,
const QuantLib::ext::shared_ptr< Integrator > &  integrator 
)

\[ \int_0^t alpha^2(u) H^n(u) du \]

Definition at line 114 of file irlgm1fparametrization.hpp.

115 {
116 auto z = zetan_cached_.find(std::make_pair(n, t));
117 if (z == zetan_cached_.end()) {
118 std::vector<Real> times;
119 for (Size i = 0; i < numberOfParameters(); ++i)
120 times.insert(times.end(), parameterTimes(i).begin(), parameterTimes(i).end());
121 PiecewiseIntegral pwint(integrator, times, true);
122 Real v = pwint([this, n](Real s) { return std::pow(this->alpha(s), 2) * std::pow(this->H(s), n); }, 0.0, t);
123 zetan_cached_[std::make_pair(n, t)] = v;
124 return v;
125 } else {
126 return z->second;
127 }
128}
std::map< std::pair< Size, Real >, Real > zetan_cached_
virtual const Array & parameterTimes(const Size) const

◆ shift()

Real & shift

allows to apply a shift to H (model invariance 1)

Definition at line 109 of file irlgm1fparametrization.hpp.

109{ return shift_; }

◆ scaling()

Real & scaling

allows to apply a scaling to H and zeta (model invariance 2), note that if a non unit scaling is provided, then the parameterValues method returns the unscaled alpha, while all other methods return scaled (and shifted) values

Definition at line 111 of file irlgm1fparametrization.hpp.

111{ return scaling_; }

◆ numberOfParameters()

Size numberOfParameters ( ) const
overridevirtual

the number of parameters in this parametrization

Reimplemented from Parametrization.

Definition at line 67 of file irlgm1fparametrization.hpp.

67{ return 2; }

◆ update()

void update
overridevirtual

this method should be called when input parameters linked via references or pointers change in order to ensure consistent results

Reimplemented from Parametrization.

Reimplemented in Lgm1fPiecewiseConstantHullWhiteAdaptor< TS >, Lgm1fPiecewiseConstantParametrization< TS >, and Lgm1fPiecewiseLinearParametrization< TS >.

Definition at line 130 of file irlgm1fparametrization.hpp.

130 {
132 zetan_cached_.clear();
133}
virtual void update() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ shift_

Real shift_
protected

Definition at line 72 of file irlgm1fparametrization.hpp.

◆ scaling_

Real scaling_
protected

Definition at line 72 of file irlgm1fparametrization.hpp.

◆ termStructure_

const Handle<TS> termStructure_
private

Definition at line 75 of file irlgm1fparametrization.hpp.

◆ zetan_cached_

std::map<std::pair<Size, Real>, Real> zetan_cached_
mutableprivate

Definition at line 76 of file irlgm1fparametrization.hpp.