33 const std::vector<Time>& taus,
34 const std::vector<Matrix>& pseudoBumps,
35 const std::vector<Spread>& displacements)
37 pseudoRoot_(pseudoRoot),
38 aliveIndex_(aliveIndex),
40 displacements_(displacements),
41 numberBumps_(pseudoBumps.size()),
42 factors_(pseudoRoot.columns()),
44 bumpedRates_(taus.size())
46 Size numberRates= taus.size();
49 "pseudoRoot_.rows()<> taus.size()");
52 "displacements_.size()<> taus.size()");
55 "drifts_.size()<> taus.size()");
57 for (
Size i=0; i < pseudoBumps.size(); ++i)
60 "pseudoBumps[i].rows()<> taus.size() with i =" << i);
63 "pseudoBumps[i].columns()<> factors with i = " << i);
67 pseudo += pseudoBumps[i];
69 driftsComputers_.emplace_back(pseudo, displacements, taus, numeraire, aliveIndex);
76 const std::vector<Real>& ,
77 const std::vector<Rate>& newRates,
78 const std::vector<Real>& gaussians,
84 "B.rows()<> numberBumps_");
87 "B.columns()<> number of rates");
123 const std::vector<Time>& taus,
124 const std::vector<Matrix>& pseudoBumps,
125 std::vector<Spread> displacements)
126 : pseudoRoot_(pseudoRoot), aliveIndex_(aliveIndex), taus_(taus), pseudoBumps_(pseudoBumps),
127 displacements_(
std::move(displacements)), numberBumps_(pseudoBumps.size()),
128 factors_(pseudoRoot.columns()),
130 e_(pseudoRoot.rows(), pseudoRoot.columns()), ratios_(taus_.size()) {
131 Size numberRates= taus.size();
134 "we can do only do discretely compounding MM acount so aliveIndex must equal numeraire");
137 "pseudoRoot_.rows()<> taus.size()");
140 "displacements_.size()<> taus.size()");
143 for (
Size i=0; i < pseudoBumps.size(); ++i)
145 QL_REQUIRE(pseudoBumps[i].rows()==numberRates,
146 "pseudoBumps[i].rows()<> taus.size() with i =" << i);
149 "pseudoBumps[i].columns()<> factors with i = " << i);
156 for (
Size i=0; i < numberRates; ++i)
164 const std::vector<Real>& discountRatios,
165 const std::vector<Rate>& newRates,
166 const std::vector<Real>& gaussians,
172 QL_REQUIRE(B.
columns() == numberRates,
"we need B.columns() which is " << B.
columns() <<
" to equal numberRates which is " << numberRates);
204 for (
Size k= j+1; k < numberRates ; ++k)
219 for (; j < numberRates; ++j)
237 const std::vector<Time>& taus,
238 std::vector<Spread> displacements)
239 : pseudoRoot_(pseudoRoot), aliveIndex_(aliveIndex), taus_(taus),
240 displacements_(
std::move(displacements)), factors_(pseudoRoot.columns()),
242 e_(pseudoRoot.rows(), pseudoRoot.columns()), ratios_(taus_.size()) {
243 Size numberRates= taus.size();
246 "we can do only do discretely compounding MM acount so aliveIndex must equal numeraire");
249 "pseudoRoot_.rows()<> taus.size()");
252 "displacements_.size()<> taus.size()");
257 const std::vector<Real>& discountRatios,
258 const std::vector<Rate>& newRates,
259 const std::vector<Real>& gaussians,
260 std::vector<Matrix>& B)
264 QL_REQUIRE(B.size() == numberRates,
"we need B.size() which is " << B.size() <<
" to equal numberRates which is " << numberRates);
267 "we need B[j].rows() which is "
268 << j.rows() <<
" to equal numberRates which is " << numberRates
269 <<
" and B[j].columns() which is " << j.columns()
270 <<
" to be equal to factors which is " <<
factors_);
285 for (
Size k=0; k < numberRates; ++k)
308 for (
Size k= j+1; k < numberRates ; ++k)
Matrix used in linear algebra.
std::vector< Spread > displacements_
Matrix pseudoRoot_
this data does not change after construction
std::vector< Time > taus_
RatePseudoRootJacobianAllElements(const Matrix &pseudoRoot, Size aliveIndex, Size numeraire, const std::vector< Time > &taus, std::vector< Spread > displacements)
void getBumps(const std::vector< Rate > &oldRates, const std::vector< Real > &oneStepDFs, const std::vector< Rate > &newRates, const std::vector< Real > &gaussians, std::vector< Matrix > &B)
std::vector< Real > ratios_
std::vector< Spread > displacements_
Matrix pseudoRoot_
this data does not change after construction
std::vector< Time > taus_
std::vector< Matrix > pseudoBumps_
std::vector< Matrix > allDerivatives_
workspace variables
void getBumps(const std::vector< Rate > &oldRates, const std::vector< Real > &oneStepDFs, const std::vector< Rate > &newRates, const std::vector< Real > &gaussians, Matrix &B)
RatePseudoRootJacobian(const Matrix &pseudoRoot, Size aliveIndex, Size numeraire, const std::vector< Time > &taus, const std::vector< Matrix > &pseudoBumps, std::vector< Spread > displacements)
std::vector< Real > ratios_
std::vector< Spread > displacements_
Matrix pseudoRoot_
this data is always the same
std::vector< Real > bumpedRates_
std::vector< Matrix > pseudoBumped_
std::vector< Time > taus_
RatePseudoRootJacobianNumerical(const Matrix &pseudoRoot, Size aliveIndex, Size numeraire, const std::vector< Time > &taus, const std::vector< Matrix > &pseudoBumps, const std::vector< Spread > &displacements)
void getBumps(const std::vector< Rate > &oldRates, const std::vector< Real > &oneStepDFs, const std::vector< Rate > &newRates, const std::vector< Real > &gaussians, Matrix &B)
std::vector< Real > drifts_
workspace variables
std::vector< LMMDriftCalculator > driftsComputers_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container