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

HW nF Parametrization with m driving Brownian motions and constant reversion, vol. More...

#include <qle/models/hwconstantparametrization.hpp>

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

Public Member Functions

 HwConstantParametrization (const QuantLib::Currency &currency, const QuantLib::Handle< TS > &termStructure, QuantLib::Matrix sigma, QuantLib::Array kappa, const std::string &name=std::string())
 
QuantLib::Matrix sigma_x (const QuantLib::Time t) const override
 
QuantLib::Array kappa (const QuantLib::Time t) const override
 
QuantLib::Matrix y (const QuantLib::Time t) const override
 
QuantLib::Array g (const QuantLib::Time t, const QuantLib::Time T) const override
 
- Public Member Functions inherited from HwParametrization< TS >
 HwParametrization (const QuantLib::Size n, const QuantLib::Size m, const QuantLib::Currency &currency, const QuantLib::Handle< TS > &termStructure, const std::string &name=std::string())
 
virtual QuantLib::Matrix sigma_x (const QuantLib::Time t) const =0
 
virtual QuantLib::Array kappa (const QuantLib::Time t) const =0
 
virtual QuantLib::Matrix y (const QuantLib::Time t) const
 
virtual QuantLib::Array g (const QuantLib::Time t, const QuantLib::Time T) const
 
const QuantLib::Handle< TS > termStructure () const
 
QuantLib::Size numberOfParameters () const override
 
QuantLib::Size n () const
 
QuantLib::Size m () const
 
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
 

Private Attributes

QuantLib::Matrix sigma_
 
QuantLib::Array kappa_
 

Static Private Attributes

static constexpr QuantLib::Real zeroKappaCutoff_ = 1.0E-6
 

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
 
- Protected Attributes inherited from HwParametrization< TS >
QuantLib::Size n_
 
QuantLib::Size m_
 
- Protected Attributes inherited from Parametrization
const Real h_
 
const Real h2_
 

Detailed Description

template<class TS>
class QuantExt::HwConstantParametrization< TS >

HW nF Parametrization with m driving Brownian motions and constant reversion, vol.

Definition at line 33 of file hwconstantparametrization.hpp.

Constructor & Destructor Documentation

◆ HwConstantParametrization()

HwConstantParametrization ( const QuantLib::Currency &  currency,
const QuantLib::Handle< TS > &  termStructure,
QuantLib::Matrix  sigma,
QuantLib::Array  kappa,
const std::string &  name = std::string() 
)

Definition at line 52 of file hwconstantparametrization.hpp.

56 : HwParametrization<TS>(kappa.size(), sigma.rows(), currency, termStructure, name.empty() ? currency.code() : name),
57 sigma_(std::move(sigma)), kappa_(std::move(kappa)) {
58 QL_REQUIRE(sigma_.columns() == kappa_.size(), "HwConstantParametrization: sigma ("
59 << sigma_.rows() << "x" << sigma_.columns()
60 << ") not consistent with kappa (" << kappa_.size() << ")");
61}
QuantLib::Array kappa(const QuantLib::Time t) const override
const QuantLib::Handle< TS > termStructure() const
const std::string & name() const
virtual const Currency & currency() const

Member Function Documentation

◆ sigma_x()

QuantLib::Matrix sigma_x ( const QuantLib::Time  t) const
overridevirtual

sigma_x, 1.12, this is a m x n matrix

Implements HwParametrization< TS >.

Definition at line 38 of file hwconstantparametrization.hpp.

38{ return sigma_; }

◆ kappa()

QuantLib::Array kappa ( const QuantLib::Time  t) const
overridevirtual

Implements HwParametrization< TS >.

Definition at line 39 of file hwconstantparametrization.hpp.

39{ return kappa_; };

◆ y()

QuantLib::Matrix y ( const QuantLib::Time  t) const
overridevirtual

y(t), 1.19, this is an n x n matrix

Reimplemented from HwParametrization< TS >.

Definition at line 63 of file hwconstantparametrization.hpp.

63 {
64 QuantLib::Matrix y(this->n_, this->n_, 0.0);
65 for (Size i = 0; i < this->n_; ++i) {
66 for (Size j = 0; j <= i; ++j) {
67 QuantLib::Real tmp;
68 if (std::abs(kappa_[i] + kappa_[j]) < zeroKappaCutoff_) {
69 tmp = t;
70 } else {
71 tmp = (1.0 - std::exp(-(kappa_[i] + kappa_[j]) * t)) / (kappa_[i] + kappa_[j]);
72 }
73 for (Size k = 0; k < this->m_; ++k) {
74 y(i, j) += sigma_x(t)(k, i) * sigma_x(t)(k, j) * tmp;
75 }
76 }
77 }
78 for (Size i = 0; i < this->n_; ++i) {
79 for (Size j = 0; j < i; ++j) {
80 y(j, i) = y(i, j);
81 }
82 }
83 return y;
84}
static constexpr QuantLib::Real zeroKappaCutoff_
QuantLib::Matrix y(const QuantLib::Time t) const override
QuantLib::Matrix sigma_x(const QuantLib::Time t) const override

◆ g()

QuantLib::Array g ( const QuantLib::Time  t,
const QuantLib::Time  T 
) const
overridevirtual

g(t,T), 1.21, this is an n-array

Reimplemented from HwParametrization< TS >.

Definition at line 87 of file hwconstantparametrization.hpp.

87 {
88 QL_REQUIRE(t <= T, "HwConstantParametrization::g(" << t << "," << T << ") invalid, expected t < T");
89 QuantLib::Array g(this->n_, 0.0);
90 for (Size i = 0; i < this->n_; ++i) {
91 if (std::abs(kappa_[i]) < zeroKappaCutoff_) {
92 g[i] = T - t;
93 } else {
94 g[i] = (1.0 - std::exp(-kappa_[i] * (T - t))) / kappa_[i];
95 }
96 }
97 return g;
98}
QuantLib::Array g(const QuantLib::Time t, const QuantLib::Time T) const override

Member Data Documentation

◆ zeroKappaCutoff_

constexpr QuantLib::Real zeroKappaCutoff_ = 1.0E-6
staticconstexprprivate

Definition at line 44 of file hwconstantparametrization.hpp.

◆ sigma_

QuantLib::Matrix sigma_
private

Definition at line 45 of file hwconstantparametrization.hpp.

◆ kappa_

QuantLib::Array kappa_
private

Definition at line 46 of file hwconstantparametrization.hpp.