27 std::vector<Date> volstepdates,
28 const std::vector<Real>& volatilities,
32 sigma_(arguments_[1]), volstepdates_(
std::move(volstepdates)) {
37 for (
Size i = 0; i < volatilities.size(); ++i)
46 std::vector<Date> volstepdates,
47 const std::vector<Real>& volatilities,
48 const std::vector<Real>& reversions,
51 sigma_(arguments_[1]), volstepdates_(
std::move(volstepdates)) {
56 for (
Size i = 0; i < volatilities.size(); ++i)
59 for (
Size i = 0; i < reversions.size(); ++i)
66 std::vector<Date> volstepdates,
71 sigma_(arguments_[1]), volatilities_(
std::move(volatilities)),
73 volstepdates_(
std::move(volstepdates)) {
80 std::vector<Date> volstepdates,
85 sigma_(arguments_[1]), volatilities_(
std::move(volatilities)),
86 reversions_(
std::move(reversions)), volstepdates_(
std::move(volstepdates)) {
94 ext::static_pointer_cast<GsrProcess>(
stateProcess_)->flushCache();
109 "volsteptimes must be strictly increasing ("
114 ext::static_pointer_cast<GsrProcess>(
stateProcess_)->flushCache();
138 "there must be n+1 volatilities ("
144 "there must be 1 or n+1 reversions ("
145 <<
reversions_.size() <<
") for n volatility step times ("
187 : yts->discount(
T,
true);
189 ext::shared_ptr<GsrProcess> p =
199 : yts->discount(
T,
true) / yts->discount(
t,
true);
201 return d * exp(-x * gtT - 0.5 * p->y(
t) * gtT * gtT);
209 ext::shared_ptr<GsrProcess> p =
214 ? this->
termStructure()->discount(p->getForwardMeasureTime(),
216 : yts->discount(p->getForwardMeasureTime());
217 return zerobond(p->getForwardMeasureTime(),
t,
y, yts);
1-D array used in linear algebra.
Real value(const Array ¶ms, const std::vector< ext::shared_ptr< CalibrationHelper > > &)
Standard constant parameter .
Real zerobond(Time T, Time t=0.0, Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >()) const
ext::shared_ptr< StochasticProcess1D > stateProcess_
std::vector< Date > volstepdates_
Real zerobondImpl(Time T, Time t, Real y, const Handle< YieldTermStructure > &yts) const override
ext::shared_ptr< ReversionObserver > reversionObserver_
std::vector< Handle< Quote > > volatilities_
std::vector< Handle< Quote > > reversions_
Gsr(const Handle< YieldTermStructure > &termStructure, std::vector< Date > volstepdates, const std::vector< Real > &volatilities, Real reversion, Real T=60.0)
const Array & reversion() const
ext::shared_ptr< VolatilityObserver > volatilityObserver_
std::vector< Time > volsteptimes_
Real numeraireImpl(Time t, Real y, const Handle< YieldTermStructure > &yts) const override
Shared handle to an observable.
bool empty() const
checks if the contained shared pointer points to anything
virtual void calculate() const
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
void setParam(Size i, Real x)
const Array & params() const
Piecewise-constant parameter.
purely virtual base class for market observables
const Handle< YieldTermStructure > & termStructure() const
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container