35 const ext::shared_ptr<G2>& model,
43 dampingSteps_(dampingSteps),
45 schemeDesc_(schemeDesc) {
56 const Date referenceDate = ts->referenceDate();
60 const ext::shared_ptr<OrnsteinUhlenbeckProcess> process1(
63 const ext::shared_ptr<OrnsteinUhlenbeckProcess> process2(
66 const ext::shared_ptr<Fdm1dMesher> xMesher(
69 const ext::shared_ptr<Fdm1dMesher> yMesher(
72 const ext::shared_ptr<FdmMesher> mesher(
76 const std::vector<Date>& exerciseDates =
arguments_.exercise->dates();
77 std::map<Time, Date> t2d;
79 for (
auto exerciseDate : exerciseDates) {
81 QL_REQUIRE(
t >= 0,
"exercise dates must not contain past date");
83 t2d[
t] = exerciseDate;
88 =
arguments_.swap->iborIndex()->forwardingTermStructure();
90 QL_REQUIRE(fwdTs->dayCounter() == disTs->dayCounter(),
91 "day counter of forward and discount curve must match");
92 QL_REQUIRE(fwdTs->referenceDate() == disTs->referenceDate(),
93 "reference date of forward and discount curve must match");
95 const ext::shared_ptr<G2> fwdModel(
99 const ext::shared_ptr<FdmInnerValueCalculator> calculator(
105 const ext::shared_ptr<FdmStepConditionComposite> conditions =
108 mesher, calculator, referenceDate, dc);
115 calculator, maturity,
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
void calculate() const override
FdG2SwaptionEngine(const ext::shared_ptr< G2 > &model, Size tGrid=100, Size xGrid=50, Size yGrid=50, Size dampingSteps=0, Real invEps=1e-5, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Hundsdorfer())
const FdmSchemeDesc schemeDesc_
Real valueAt(Real x, Real y) const
static ext::shared_ptr< FdmStepConditionComposite > vanillaComposite(const DividendSchedule &schedule, const ext::shared_ptr< Exercise > &exercise, const ext::shared_ptr< FdmMesher > &mesher, const ext::shared_ptr< FdmInnerValueCalculator > &calculator, const Date &refDate, const DayCounter &dayCounter)
Two-additive-factor gaussian model class.
Base class for some pricing engine on a particular model.
Shared handle to an observable.
bool empty() const
checks if the contained shared pointer points to anything
const ext::shared_ptr< T > & currentLink() const
dereferencing
Ornstein-Uhlenbeck process class.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
finite differences swaption engine
memory layout of a fdm linear operator
FdmMesher which is a composite of Fdm1dMesher.
One-dimensional grid mesher.
composite of fdm step conditions
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
base class for Inter-Bank-Offered-Rate indexes
std::vector< ext::shared_ptr< Dividend > > DividendSchedule
OperatorTraits< FdmLinearOp >::bc_set FdmBoundaryConditionSet
Ornstein-Uhlenbeck process.