27#ifndef quantlib_gaussian1dmodel_hpp
28#define quantlib_gaussian1dmodel_hpp
30#include <ql/models/model.hpp>
31#include <ql/models/parameter.hpp>
32#include <ql/indexes/iborindex.hpp>
33#include <ql/indexes/swapindex.hpp>
34#include <ql/instruments/vanillaswap.hpp>
35#include <ql/time/date.hpp>
36#include <ql/time/period.hpp>
37#include <ql/termstructures/yieldtermstructure.hpp>
38#include <ql/stochasticprocess.hpp>
39#include <ql/utilities/null.hpp>
40#include <ql/patterns/lazyobject.hpp>
42#ifdef GAUSS1D_ENABLE_NTL
43#include <boost/math/bindings/rr.hpp>
46#if BOOST_VERSION < 106700
47#include <boost/functional/hash.hpp>
49#include <boost/container_hash/hash.hpp>
52#include <unordered_map>
74 ext::shared_ptr<StochasticProcess1D>
stateProcess()
const;
96 const Date& valueDate,
103 Size yGridPoints = 64,
104 bool extrapolatePayoff =
true,
105 bool flatPayoffExtrapolation =
false)
const;
111 const ext::shared_ptr<IborIndex>& iborIdx = ext::shared_ptr<IborIndex>())
const;
117 const ext::shared_ptr<SwapIndex>& swapIdx = ext::shared_ptr<SwapIndex>())
const;
124 const ext::shared_ptr<SwapIndex>& swapIdx = ext::shared_ptr<SwapIndex>())
const;
157 const ext::shared_ptr<SwapIndex>
index;
168 std::size_t seed = 0;
169 boost::hash_combine(seed, x.
index->name());
204 ext::shared_ptr<VanillaSwap>
206 const Date &expiry,
const Period &tenor)
const {
211 ext::shared_ptr<VanillaSwap> underlying =
212 index->clone(tenor)->underlyingSwap(expiry);
213 swapCache_.insert(std::make_pair(k, underlying));
226 QL_REQUIRE(
stateProcess_ !=
nullptr,
"state process not set");
1-D array used in linear algebra.
Date::serial_type serialNumber() const
void performCalculations() const override
static Real gaussianPolynomialIntegral(Real a, Real b, Real c, Real d, Real e, Real x0, Real x1)
static Real gaussianShiftedPolynomialIntegral(Real a, Real b, Real c, Real d, Real e, Real h, Real x0, Real x1)
ext::shared_ptr< VanillaSwap > underlyingSwap(const ext::shared_ptr< SwapIndex > &index, const Date &expiry, const Period &tenor) const
virtual Real zerobondImpl(Time T, Time t, Real y, const Handle< YieldTermStructure > &yts) const =0
Real numeraire(Time t, Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >()) const
virtual Real numeraireImpl(Time t, Real y, const Handle< YieldTermStructure > &yts) const =0
Real swapRate(const Date &fixing, const Period &tenor, const Date &referenceDate=Null< Date >(), Real y=0.0, const ext::shared_ptr< SwapIndex > &swapIdx=ext::shared_ptr< SwapIndex >()) const
Array yGrid(Real yStdDevs, int gridPoints, Real T=1.0, Real t=0, Real y=0) const
std::unordered_map< CachedSwapKey, ext::shared_ptr< VanillaSwap >, CachedSwapKeyHasher > swapCache_
Real forwardRate(const Date &fixing, const Date &referenceDate=Null< Date >(), Real y=0.0, const ext::shared_ptr< IborIndex > &iborIdx=ext::shared_ptr< IborIndex >()) const
bool enforcesTodaysHistoricFixings_
Real zerobond(Time T, Time t=0.0, Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >()) const
ext::shared_ptr< StochasticProcess1D > stateProcess() const
Real zerobondOption(const Option::Type &type, const Date &expiry, const Date &valueDate, const Date &maturity, Rate strike, const Date &referenceDate=Null< Date >(), Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >(), Real yStdDevs=7.0, Size yGridPoints=64, bool extrapolatePayoff=true, bool flatPayoffExtrapolation=false) const
Real swapAnnuity(const Date &fixing, const Period &tenor, const Date &referenceDate=Null< Date >(), Real y=0.0, const ext::shared_ptr< SwapIndex > &swapIdx=ext::shared_ptr< SwapIndex >()) const
Gaussian1dModel(const Handle< YieldTermStructure > &yieldTermStructure)
ext::shared_ptr< StochasticProcess1D > stateProcess_
Shared handle to an observable.
Framework for calculation on demand and result caching.
virtual void calculate() const
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
DateProxy & evaluationDate()
the date at which pricing is to be performed.
bool & enforcesTodaysHistoricFixings()
static Settings & instance()
access to the unique instance
Term-structure consistent model class.
const Handle< YieldTermStructure > & termStructure() const
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
std::size_t operator()(CachedSwapKey const &x) const
const ext::shared_ptr< SwapIndex > index
bool operator==(const CachedSwapKey &o) const