36 QuantLib::Matrix sigma, QuantLib::Array
kappa,
const std::string&
name = std::string());
38 QuantLib::Matrix
sigma_x(
const QuantLib::Time t)
const override {
return sigma_; }
39 QuantLib::Array
kappa(
const QuantLib::Time t)
const override {
return kappa_; };
40 QuantLib::Matrix
y(
const QuantLib::Time t)
const override;
41 QuantLib::Array
g(
const QuantLib::Time t,
const QuantLib::Time T)
const override;
53 const QuantLib::Handle<TS>& termStructure,
54 QuantLib::Matrix sigma, QuantLib::Array kappa,
55 const std::string& name)
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 ("
60 <<
") not consistent with kappa (" <<
kappa_.size() <<
")");
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) {
68 if (std::abs(kappa_[i] + kappa_[j]) < zeroKappaCutoff_) {
71 tmp = (1.0 - std::exp(-(kappa_[i] + kappa_[j]) * t)) / (kappa_[i] + kappa_[j]);
73 for (Size k = 0; k < this->m_; ++k) {
74 y(i, j) += sigma_x(t)(k, i) * sigma_x(t)(k, j) * tmp;
78 for (Size i = 0; i < this->n_; ++i) {
79 for (Size j = 0; j < i; ++j) {
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_) {
94 g[i] = (1.0 - std::exp(-kappa_[i] * (T - t))) / kappa_[i];
HW nF Parametrization with m driving Brownian motions and constant reversion, vol.
HwConstantParametrization(const QuantLib::Currency ¤cy, const QuantLib::Handle< TS > &termStructure, QuantLib::Matrix sigma, QuantLib::Array kappa, const std::string &name=std::string())
QuantLib::Array g(const QuantLib::Time t, const QuantLib::Time T) const override
QuantLib::Array kappa(const QuantLib::Time t) const override
static constexpr QuantLib::Real zeroKappaCutoff_
QuantLib::Matrix y(const QuantLib::Time t) const override
QuantLib::Matrix sigma_x(const QuantLib::Time t) const override
HW nF Parametrization with m driving Brownian motions.
const QuantLib::Handle< TS > termStructure() const
const std::string & name() const
virtual const Currency & currency() const
Hull White n factor parametrization.
HwConstantParametrization< YieldTermStructure > IrHwConstantParametrization