26 const ext::shared_ptr<LiborForwardModelProcess> & process,
27 const ext::shared_ptr<OptionletVolatilityStructure> & capletVol,
30 diffusion_ (
size_-1, factors_),
31 fixingTimes_(process->fixingTimes()) {
34 if (correlation.
empty()) {
36 "correlation matrix must be given for "
37 "multi factor models");
41 "wrong dimesion of the correlation matrix");
44 "too many factors for given LFM process");
53 Real p = std::sqrt(std::inner_product(
54 tmpSqrtCorr[i],tmpSqrtCorr[i]+
factors_,
55 tmpSqrtCorr[i],
Real(0.0)));
57 tmpSqrtCorr[i], tmpSqrtCorr[i]+
factors_, sqrtCorr[i],
58 [=](
Real x) ->
Real {
return x / p; });
62 std::vector<Volatility> lambda;
63 const std::vector<Time> fixingTimes = process->fixingTimes();
64 const std::vector<Date> fixingDates = process->fixingDates();
68 for (
Size j = 1; j < i; ++j) {
69 cumVar += lambda[i-j-1] * lambda[i-j-1]
70 * (fixingTimes[j+1] - fixingTimes[j]);
73 const Volatility vol = capletVol->volatility(fixingDates[i], 0.0);
75 * capletVol->dayCounter().yearFraction(fixingDates[0],
78 lambda.push_back(std::sqrt( (var - cumVar)
79 / (fixingTimes[1] - fixingTimes[0])) );
129 for (
Size i=0; i<last; ++i) {
1-D array used in linear algebra.
Libor market model parameterization
Matrix covariance(Time t, const Array &x=Null< Array >()) const override
Matrix diffusion(Time t, const Array &x=Null< Array >()) const override
Matrix integratedCovariance(Time t, const Array &x=Null< Array >()) const override
Size nextIndexReset(Time t) const
std::vector< Time > fixingTimes_
LfmHullWhiteParameterization(const ext::shared_ptr< LiborForwardModelProcess > &process, const ext::shared_ptr< OptionletVolatilityStructure > &capletVol, const Matrix &correlation=Matrix(), Size factors=1)
Matrix used in linear algebra.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Time
continuous quantity with 1-year units
Real Volatility
volatility
std::size_t Size
size of a container
libor market model parameterization based on Hull White
Matrix pseudoSqrt(const Matrix &matrix, SalvagingAlgorithm::Type sa)
Matrix transpose(const Matrix &m)
ext::shared_ptr< YieldTermStructure > q
pseudo square root of a real symmetric matrix