34 QL_REQUIRE(offset < multiplier,
"offset must be less than period in"
35 " forward forward mappings");
36 Size k = (
n-offset)/multiplier;
38 const std::vector<Time>& tau = cs.
rateTaus();
43 for (
Size l=0; l < k; ++l)
49 for (
Size r=0;
r < multiplier; ++
r, ++m)
53 jacobian[l][m]=-value;
62 const std::vector<Spread>& shortDisplacements,
63 const std::vector<Spread>& longDisplacements,
68 QL_REQUIRE(offset < multiplier,
"offset must be less than period in"
69 " forward forward mappings");
70 Size k = (
n-offset)/multiplier;
73 QL_REQUIRE(shortDisplacements.size() ==
n ,
"shortDisplacements must be of size"
74 " equal to number of rates");
76 QL_REQUIRE(longDisplacements.size() == k ,
"longDisplacements must be of size"
77 " equal to (number of rates minus offset) divided by multiplier");
81 for (
Size i=0; i < k ; ++i)
86 Real longForward = (cs.
discountRatio((i+1)*multiplier+offset,i*multiplier+offset)-1.0)
88 Real longForwardDisplaced = longForward+ longDisplacements[i];
89 for (
Size j=0; j <
n; ++j)
92 Real shortForwardDisplaced = shortForward+shortDisplacements[j];
93 jacobian[i][j] *= shortForwardDisplaced/longForwardDisplaced;
106 QL_REQUIRE(offset < multiplier,
"offset must be less than period in"
107 " forward forward mappings");
108 Size k = (
n-offset)/multiplier;
110 std::vector<Time> times(k+1);
111 std::vector<DiscountFactor> discRatios(k+1);
114 for (
Size i=0; i < k+1; ++i)
116 times[i] = cs.
rateTimes()[i*multiplier+offset];
Curve state for market-model simulations
Size numberOfRates() const
virtual Rate forwardRate(Size i) const =0
const std::vector< Time > & rateTimes() const
const std::vector< Time > & rateTaus() const
virtual Real discountRatio(Size i, Size j) const =0
Curve state for Libor market models
void setOnDiscountRatios(const std::vector< DiscountFactor > &discRatios, Size firstValidIndex=0)
Matrix used in linear algebra.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Utility functions for mapping between forward rates of varying tenor.
std::size_t Size
size of a container
Matrix ForwardForwardJacobian(const CurveState &cs, Size multiplier, Size offset)
LMMCurveState RestrictCurveState(const CurveState &cs, Size multiplier, Size offSet)
Matrix YMatrix(const CurveState &cs, const std::vector< Spread > &shortDisplacements, const std::vector< Spread > &longDisplacements, Size Multiplier, Size offset)
ext::shared_ptr< YieldTermStructure > r