29 const std::vector<Spread>& displacements,
30 const std::vector<Time>& taus,
34 : numberOfRates_(taus.size()), numberOfFactors_(pseudo.columns()),
35 numeraire_(numeraire), alive_(alive),
36 displacements_(displacements), oneOverTaus_(taus.size()),
37 pseudo_(pseudo), tmp_(taus.size(), 0.0),
38 PjPnWk_(numberOfFactors_,1+taus.size()),
39 wkaj_(numberOfFactors_, taus.size()),
40 wkajN_(numberOfFactors_, taus.size()),
41 downs_(taus.size()), ups_(taus.size()),
42 spanningFwds_(spanningFwds) {
47 "Displacements out of range");
49 "pseudo.rows() not consistent with dim");
51 "pseudo.rows() not consistent with pseudo.columns()");
53 "Alive out of bounds");
55 "Numeraire larger than dim");
57 "Numeraire smaller than alive");
60 for (
Size i=0; i<taus.size(); ++i)
75 std::vector<Real>& drifts)
const {
76 #if defined(QL_EXTRA_SAFETY_CHECKS)
78 "drifts.size() <> numberOfRates");
81 const std::vector<Time>& taus = cs.
rateTaus();
std::vector< Spread > displacements_
CMSMMDriftCalculator(const Matrix &pseudo, const std::vector< Spread > &displacements, const std::vector< Time > &taus, Size numeraire, Size alive, Size spanningFwds)
void compute(const CMSwapCurveState &cs, std::vector< Real > &drifts) const
Computes the drifts.
std::vector< Real > oneOverTaus_
std::vector< Size > downs_
Curve state for constant-maturity-swap market models
Real discountRatio(Size i, Size j) const override
Rate cmSwapAnnuity(Size numeraire, Size i, Size spanningForwards) const override
Rate cmSwapRate(Size i, Size spanningForwards) const override
Size numberOfRates() const
const std::vector< Time > & rateTaus() const
Matrix used in linear algebra.
Drift computation for CMS market model.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
QL_INTEGER Integer
integer number
std::size_t Size
size of a container
Matrix transpose(const Matrix &m)