35 std::vector<Spread> newDisplacements)
36 : numberOfFactors_(largeModel->numberOfFactors()),
37 numberOfRates_((largeModel->numberOfRates() - offset) / (period > 0 ? period : 1)),
38 numberOfSteps_(largeModel->numberOfSteps()),
39 pseudoRoots_(numberOfSteps_,
Matrix(numberOfRates_, numberOfFactors_)),
40 displacements_(
std::move(newDisplacements)) {
41 QL_REQUIRE( period >0,
"period must be greater than zero in fwdperiodadapter");
42 QL_REQUIRE(period > offset,
"period must be greater than offset in fwdperiodadapter");
44 const std::vector<Spread>& largeDisplacements_ =
45 largeModel->displacements();
61 for (
Size l=0; l < period; ++l, ++m)
62 sum+= largeDisplacements_[m];
80 std::vector<Time> oldEvolutionTimes(largeModel->evolution().evolutionTimes());
81 std::vector<Time> newEvolutionTimes;
82 for (
Size i =0; i < oldEvolutionTimes.size() && oldEvolutionTimes[i]<= finalReset; ++i)
83 newEvolutionTimes.push_back(oldEvolutionTimes[i]);
91 const std::vector<Time>& rateTimes =
94 const std::vector<Time>& evolutionTimes =
97 std::set<Time> setTimes(evolutionTimes.begin(),evolutionTimes.end());
99 for (
Size i=0; i < rateTimes.size()-1; ++i)
100 QL_REQUIRE(setTimes.find(rateTimes[i]) != setTimes.end(),
101 "every new rate time except last must be an evolution time in fwdperiod adapter");
112 const std::vector<Size>& alive =
117 for (
Size i=0; i<alive[k]; ++i)
Size numberOfRates() const
const std::vector< Time > & rateTimes() const
Market-model evolution description.
const std::vector< Time > & evolutionTimes() const
const std::vector< Size > & firstAliveRate() const
FwdPeriodAdapter(const ext::shared_ptr< MarketModel > &largeModel, Size period, Size offset, std::vector< Spread > newDisplacements_)
std::vector< Spread > displacements_
std::vector< Matrix > pseudoRoots_
std::vector< Rate > initialRates_
EvolutionDescription evolution_
Curve state for Libor market models
void setOnForwardRates(const std::vector< Rate > &fwdRates, Size firstValidIndex=0)
const std::vector< Rate > & forwardRates() const override
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
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)