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

LGM 1f Piecewise Constant Hull White Adaptor. More...

#include <qle/models/irlgm1fpiecewiseconstanthullwhiteadaptor.hpp>

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

Public Member Functions

 Lgm1fPiecewiseConstantHullWhiteAdaptor (const Currency &currency, const Handle< TS > &termStructure, const Array &sigmaTimes, const Array &sigma, const Array &kappaTimes, const Array &kappa, const std::string &name=std::string(), const QuantLib::ext::shared_ptr< QuantLib::Constraint > &sigmaConstraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >(), const QuantLib::ext::shared_ptr< QuantLib::Constraint > &kappaConstraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
 Lgm1fPiecewiseConstantHullWhiteAdaptor (const Currency &currency, const Handle< TS > &termStructure, const std::vector< Date > &sigmaDates, const Array &sigma, const std::vector< Date > &kappaDates, const Array &kappa, const std::string &name=std::string(), const QuantLib::ext::shared_ptr< QuantLib::Constraint > &sigmaConstraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >(), const QuantLib::ext::shared_ptr< QuantLib::Constraint > &kappaConstraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
Real zeta (const Time t) const override
 
Real H (const Time t) const override
 
Real alpha (const Time t) const override
 
Real kappa (const Time t) const override
 
Real Hprime (const Time t) const override
 
Real Hprime2 (const Time t) const override
 
Real hullWhiteSigma (const Time t) const override
 
const Array & parameterTimes (const Size) const override
 
const QuantLib::ext::shared_ptr< Parameter > parameter (const Size) const override
 
void update () const override
 
- Public Member Functions inherited from Lgm1fParametrization< TS >
 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 Member Functions

Real direct (const Size i, const Real x) const override
 
Real inverse (const Size j, const Real y) const override
 
- 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
 

Private Member Functions

void initialize (const Array &sigma, const Array &kappa)
 
- Private Member Functions inherited from PiecewiseConstantHelper3
 PiecewiseConstantHelper3 (const Array &t1, const Array &t2, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint1=QuantLib::ext::make_shared< QuantLib::NoConstraint >(), const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint2=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
 PiecewiseConstantHelper3 (const std::vector< Date > &dates1, const std::vector< Date > &dates2, const Handle< YieldTermStructure > &yts, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint1=QuantLib::ext::make_shared< QuantLib::NoConstraint >(), const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint2=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
const Array & t1 () const
 
const Array & t2 () const
 
const Array & tUnion () const
 
const QuantLib::ext::shared_ptr< Parameter > p1 () const
 
const QuantLib::ext::shared_ptr< Parameter > p2 () const
 
void update () const
 
Real y1 (const Time t) const
 
Real y2 (const Time t) const
 
Real int_y1_sqr_exp_2_int_y2 (const Time t) const
 int_0^t y1^2(s) exp(2*int_0^s y2(u) du) ds More...
 
Real direct1 (const Real x) const
 
Real inverse1 (const Real y) const
 
Real direct2 (const Real x) const
 
Real inverse2 (const Real y) const
 
- Private Member Functions inherited from PiecewiseConstantHelper2
 PiecewiseConstantHelper2 (const Array &t, const QuantLib::ext::shared_ptr< PseudoParameter > &y)
 
 PiecewiseConstantHelper2 (const Array &t, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
 PiecewiseConstantHelper2 (const std::vector< Date > &dates, const Handle< YieldTermStructure > &yts, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
const Array & t () const
 
const QuantLib::ext::shared_ptr< Parameter > p () const
 
void update () const
 
Real y (const Time t) const
 
Real exp_m_int_y (const Time t) const
 exp(int_0^t -y(s)) ds More...
 
Real int_exp_m_int_y (const Time t) const
 int_0^t exp(int_0^s -y(u) du) ds More...
 
Real direct (const Real x) const
 
Real inverse (const Real y) const
 

Additional Inherited Members

- Protected Attributes inherited from Lgm1fParametrization< TS >
Real shift_
 
Real scaling_
 
- Protected Attributes inherited from Parametrization
const Real h_
 
const Real h2_
 
- Private Attributes inherited from PiecewiseConstantHelper3
const Array t1_
 
const Array t2_
 
Array tUnion_
 
const QuantLib::ext::shared_ptr< PseudoParametery1_
 
const QuantLib::ext::shared_ptr< PseudoParametery2_
 
Array y1Union_
 
Array y2Union_
 
- Private Attributes inherited from PiecewiseConstantHelper2
const Array t_
 
const QuantLib::ext::shared_ptr< PseudoParametery_
 

Detailed Description

template<class TS>
class QuantExt::Lgm1fPiecewiseConstantHullWhiteAdaptor< TS >

LGM 1f Piecewise Constant Hull White Adaptor.

Definition at line 37 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

Constructor & Destructor Documentation

◆ Lgm1fPiecewiseConstantHullWhiteAdaptor() [1/2]

Lgm1fPiecewiseConstantHullWhiteAdaptor ( const Currency &  currency,
const Handle< TS > &  termStructure,
const Array &  sigmaTimes,
const Array &  sigma,
const Array &  kappaTimes,
const Array &  kappa,
const std::string &  name = std::string(),
const QuantLib::ext::shared_ptr< QuantLib::Constraint > &  sigmaConstraint = QuantLib::ext::make_shared<QuantLib::NoConstraint>(),
const QuantLib::ext::shared_ptr< QuantLib::Constraint > &  kappaConstraint = QuantLib::ext::make_shared<QuantLib::NoConstraint>() 
)

Definition at line 74 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

79 : Lgm1fParametrization<TS>(currency, termStructure, name),
80 PiecewiseConstantHelper3(sigmaTimes, kappaTimes, sigmaConstraint, kappaConstraint),
82 initialize(sigma, kappa);
83}
const Handle< TS > termStructure() const
const std::string & name() const
virtual const Currency & currency() const
PiecewiseConstantHelper2(const Array &t, const QuantLib::ext::shared_ptr< PseudoParameter > &y)
PiecewiseConstantHelper3(const Array &t1, const Array &t2, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint1=QuantLib::ext::make_shared< QuantLib::NoConstraint >(), const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint2=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
const QuantLib::ext::shared_ptr< PseudoParameter > y2_
+ Here is the call graph for this function:

◆ Lgm1fPiecewiseConstantHullWhiteAdaptor() [2/2]

Lgm1fPiecewiseConstantHullWhiteAdaptor ( const Currency &  currency,
const Handle< TS > &  termStructure,
const std::vector< Date > &  sigmaDates,
const Array &  sigma,
const std::vector< Date > &  kappaDates,
const Array &  kappa,
const std::string &  name = std::string(),
const QuantLib::ext::shared_ptr< QuantLib::Constraint > &  sigmaConstraint = QuantLib::ext::make_shared<QuantLib::NoConstraint>(),
const QuantLib::ext::shared_ptr< QuantLib::Constraint > &  kappaConstraint = QuantLib::ext::make_shared<QuantLib::NoConstraint>() 
)

Definition at line 86 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

91 : Lgm1fParametrization<TS>(currency, termStructure, name),
92 PiecewiseConstantHelper3(sigmaDates, kappaDates, termStructure, sigmaConstraint, kappaConstraint),
94 initialize(sigma, kappa);
95}
+ Here is the call graph for this function:

Member Function Documentation

◆ zeta()

Real zeta ( const Time  t) const
overridevirtual

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

Implements Lgm1fParametrization< TS >.

Definition at line 126 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

126 {
128}
Real int_y1_sqr_exp_2_int_y2(const Time t) const
int_0^t y1^2(s) exp(2*int_0^s y2(u) du) ds
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ H()

Real H ( const Time  t) const
overridevirtual

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

Implements Lgm1fParametrization< TS >.

Definition at line 134 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

134 {
136}
Real int_exp_m_int_y(const Time t) const
int_0^t exp(int_0^s -y(u) du) ds
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alpha()

Real alpha ( const Time  t) const
overridevirtual

Reimplemented from Lgm1fParametrization< TS >.

Definition at line 130 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

+ Here is the caller graph for this function:

◆ kappa()

Real kappa ( const Time  t) const
overridevirtual

Reimplemented from Lgm1fParametrization< TS >.

Definition at line 138 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

138 {
140}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Hprime()

Real Hprime ( const Time  t) const
overridevirtual

Reimplemented from Lgm1fParametrization< TS >.

Definition at line 142 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

142 {
144}
Real exp_m_int_y(const Time t) const
exp(int_0^t -y(s)) ds
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Hprime2()

Real Hprime2 ( const Time  t) const
overridevirtual

Reimplemented from Lgm1fParametrization< TS >.

Definition at line 146 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

146 {
148}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hullWhiteSigma()

Real hullWhiteSigma ( const Time  t) const
overridevirtual

Reimplemented from Lgm1fParametrization< TS >.

Definition at line 150 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

150 {
152}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parameterTimes()

const Array & parameterTimes ( const Size  Size) const
overridevirtual

the times associated to parameter i

Reimplemented from Parametrization.

Definition at line 160 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

160 {
161 QL_REQUIRE(i < 2, "parameter " << i << " does not exist, only have 0..1");
162 if (i == 0)
164 else
166}

◆ parameter()

const QuantLib::ext::shared_ptr< Parameter > parameter ( const Size  Size) const
overridevirtual

the parameter storing the raw parameter values

Reimplemented from Parametrization.

Definition at line 169 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

169 {
170 QL_REQUIRE(i < 2, "parameter " << i << " does not exist, only have 0..1");
171 if (i == 0)
173 else
175}
const QuantLib::ext::shared_ptr< PseudoParameter > y_
const QuantLib::ext::shared_ptr< PseudoParameter > y1_

◆ 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 Lgm1fParametrization< TS >.

Definition at line 154 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

+ Here is the call graph for this function:

◆ direct()

Real direct ( const Size  Size,
const Real  x 
) const
overrideprotectedvirtual

transformations between raw and actual parameters

Reimplemented from Parametrization.

Definition at line 118 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

+ Here is the call graph for this function:

◆ inverse()

Real inverse ( const Size  j,
const Real  y 
) const
overrideprotectedvirtual

Reimplemented from Parametrization.

Definition at line 122 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

+ Here is the call graph for this function:

◆ initialize()

void initialize ( const Array &  sigma,
const Array &  kappa 
)
private

Definition at line 98 of file irlgm1fpiecewiseconstanthullwhiteadaptor.hpp.

98 {
99 QL_REQUIRE(PiecewiseConstantHelper3::t1().size() + 1 == sigma.size(),
100 "sigma size (" << sigma.size() << ") inconsistent to times size ("
101 << PiecewiseConstantHelper3::t1().size() << ")");
102 QL_REQUIRE(PiecewiseConstantHelper2::t().size() + 1 == kappa.size(),
103 "kappa size (" << kappa.size() << ") inconsistent to times size ("
104 << PiecewiseConstantHelper2::t().size() << ")");
105
106 // store raw parameter values
107 for (Size i = 0; i < PiecewiseConstantHelper3::y1_->size(); ++i) {
108 PiecewiseConstantHelper3::y1_->setParam(i, inverse(0, sigma[i]));
109 }
110 for (Size i = 0; i < PiecewiseConstantHelper3::y2_->size(); ++i) {
111 PiecewiseConstantHelper3::y2_->setParam(i, inverse(1, kappa[i]));
112 }
113 update();
114}
+ Here is the call graph for this function:
+ Here is the caller graph for this function: