35 const vector<Real>& ks,
36 const ext::shared_ptr<PiecewiseConstantCorrelation>& corr,
38 const Size numberOfFactors,
39 const vector<Rate>& initialRates,
40 const vector<Spread>& displacements)
41 : numberOfFactors_(numberOfFactors),
42 numberOfRates_(initialRates.size()),
43 numberOfSteps_(evolution.evolutionTimes().size()),
44 initialRates_(initialRates),
45 displacements_(displacements),
46 evolution_(evolution),
47 pseudoRoots_(numberOfSteps_,
Matrix(numberOfRates_, numberOfFactors_))
58 ") and ks (" << ks.size() <<
")");
65 ") cannot be greater than numberOfRates (" <<
69 ") must be greater than zero");
72 Time effStopTime = 0.0;
73 const vector<Time>& corrTimes = corr->times();
82 for (; corrTimes[kk]<evolTimes[k]; ++kk) {
83 Time effStartTime = effStopTime;
84 effStopTime = corrTimes[kk];
85 const Matrix& corrMatrix = corr->correlation(kk);
97 Time effStartTime = effStopTime;
98 effStopTime = evolTimes[k];
99 const Matrix& corrMatrix = corr->correlation(kk);
110 while (kk<corrTimes.size() && corrTimes[kk]<=evolTimes[k])
126 <<
" abcd vol wrong number of rows: "
131 <<
" abcd vol wrong number of columns: "
Abcd functional form for instantaneous volatility
Real covariance(Time t, Time T, Time S) const
const std::vector< Spread > & displacements() const override
AbcdVol(Real a, Real b, Real c, Real d, const std::vector< Real > &ks, const ext::shared_ptr< PiecewiseConstantCorrelation > &corr, const EvolutionDescription &evolution, Size numberOfFactors, const std::vector< Rate > &initialRates, const std::vector< Spread > &displacements)
std::vector< Matrix > pseudoRoots_
const EvolutionDescription & evolution() const override
Size numberOfFactors() const override
Market-model evolution description.
const std::vector< Time > & rateTimes() const
const std::vector< Time > & evolutionTimes() const
virtual const Matrix & covariance(Size i) const
Matrix used in linear algebra.
const_iterator begin() const
const_iterator end() const
#define QL_ENSURE(condition, message)
throw an error if the given post-condition is not verified
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
ext::function< Real(Real)> b
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
Matrix rankReducedSqrt(const Matrix &matrix, Size maxRank, Real componentRetainedPercentage, SalvagingAlgorithm::Type sa)
pseudo square root of a real symmetric matrix