24#ifndef quantext_cirpp_constant_feller_parametrization_hpp
25#define quantext_cirpp_constant_feller_parametrization_hpp
29#include <ql/errors.hpp>
43 const Real fellerFactor = 2.0,
44 const std::string&
name = std::string());
46 Real
kappa(
const Time t)
const override;
47 Real
theta(
const Time t)
const override;
48 Real
sigma(
const Time t)
const override;
49 Real
y0(
const Time t)
const override;
51 const QuantLib::ext::shared_ptr<Parameter>
parameter(
const Size)
const override;
55 Real
direct(
const Size i,
const Real x)
const override;
56 Real
inverse(
const Size j,
const Real y)
const override;
68 const Currency& currency,
const Handle<TS>& termStructure,
const Real kappa,
const Real theta,
const Real sigma,
69 const Real y0,
const bool shifted,
bool relaxed,
const Real fellerFactor,
const std::string& name)
75 "CirppConstantWithFellerParametrization: Feller constraint violated (kappa="
78 QL_REQUIRE(
fellerFactor_ > 1.0,
"CirppConstantWithFellerParametrization: Feller factor ("
88 constexpr Real eps = 1E-10;
95 const Real fellerBound =
96 std::sqrt((relaxed_ ? 4.0 : 2.0) * direct(0, kappa_->params()[0]) * direct(1, theta_->params()[0]));
98 return fellerBound / std::sqrt(fellerFactor_);
101 QL_FAIL(
"Index is not defined!");
107 constexpr Real eps = 1E-10;
112 return std::sqrt(y - eps);
114 const Real fellerBound =
115 std::sqrt((relaxed_ ? 4.0 : 2.0) * direct(0, kappa_->params()[0]) * direct(1, theta_->params()[0]));
117 return fellerBound / std::sqrt(fellerFactor_);
120 QL_FAIL(
"Index is not defined!");
125 return direct(0, kappa_->params()[0]);
129 return direct(1, theta_->params()[0]);
133 return direct(2, sigma_->params()[0]);
137 return direct(3, y0_->params()[0]);
145inline const QuantLib::ext::shared_ptr<Parameter>
147 QL_REQUIRE(i < 4,
"parameter " << i <<
" does not exist, only have 0..3");
CIR++ Constant Parametrization.
Real kappa(const Time t) const override
const bool relaxed() const
Real theta(const Time t) const override
Real y0(const Time t) const override
Real sigma(const Time t) const override
const QuantLib::ext::shared_ptr< PseudoParameter > theta_
Real direct(const Size i, const Real x) const override
const QuantLib::ext::shared_ptr< PseudoParameter > sigma_
const QuantLib::ext::shared_ptr< PseudoParameter > y0_
Real inverse(const Size j, const Real y) const override
const QuantLib::ext::shared_ptr< PseudoParameter > kappa_
const QuantLib::ext::shared_ptr< Parameter > parameter(const Size) const override
CirppConstantWithFellerParametrization(const Currency ¤cy, const Handle< TS > &termStructure, const Real kappa, const Real theta, const Real sigma, const Real y0, const bool shifted, bool relaxed=false, const Real fellerFactor=2.0, const std::string &name=std::string())
const Handle< TS > termStructure() const
const bool shifted() const
const std::string & name() const
virtual const Currency & currency() const
Parameter that accesses CalibratedModel.
CirppConstantWithFellerParametrization< YieldTermStructure > IrCirppConstantWithFellerParametrization
CirppConstantWithFellerParametrization< DefaultProbabilityTermStructure > CrCirppConstantWithFellerParametrization