44 : type(aType),
theta(aTheta), mu(aMu) { }
81 ext::shared_ptr<FdmLinearOpComposite> map,
83 const ext::shared_ptr<FdmStepConditionComposite>& condition,
85 : map_(
std::move(map)), bcSet_(
std::move(bcSet)),
86 condition_((condition) != nullptr ?
90 schemeDesc_(schemeDesc) {}
96 const Time deltaT = from - to;
97 const Size allSteps = steps + dampingSteps;
98 const Time dampingTo = from - (deltaT*dampingSteps)/allSteps;
103 dampingModel(implicitEvolver,
condition_->stoppingTimes());
104 dampingModel.
rollback(rhs, from, dampingTo,
114 hsModel(hsEvolver,
condition_->stoppingTimes());
122 dsModel(dsEvolver,
condition_->stoppingTimes());
130 cnModel(cnEvolver,
condition_->stoppingTimes());
140 csModel(csEvolver,
condition_->stoppingTimes());
150 mcsModel(csEvolver,
condition_->stoppingTimes());
158 implicitModel(implicitEvolver,
condition_->stoppingTimes());
166 explicitModel(explicitEvolver,
condition_->stoppingTimes());
175 molModel(methodOfLines,
condition_->stoppingTimes());
184 const ext::shared_ptr<CraigSneydScheme> hsEvolver(
185 ext::make_shared<CraigSneydScheme>(
192 trBDF2Model(trBDF2,
condition_->stoppingTimes());
197 QL_FAIL(
"Unknown scheme type");
1-D array used in linear algebra.
void rollback(array_type &a, Time from, Time to, Size steps, Size dampingSteps)
FdmBackwardSolver(ext::shared_ptr< FdmLinearOpComposite > map, FdmBoundaryConditionSet bcSet, const ext::shared_ptr< FdmStepConditionComposite > &condition, const FdmSchemeDesc &schemeDesc)
const FdmBoundaryConditionSet bcSet_
const ext::shared_ptr< FdmLinearOpComposite > map_
const ext::shared_ptr< FdmStepConditionComposite > condition_
const FdmSchemeDesc schemeDesc_
Generic finite difference model.
void rollback(array_type &a, Time from, Time to, Size steps)
modified Craig-Sneyd scheme
Craig-Sneyd operator splitting.
Douglas operator splitting.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
composite of fdm step conditions
generic finite difference model
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
Hundsdorfer operator splitting.
modified Craig-Sneyd operator splitting
OperatorTraits< FdmLinearOp >::bc_set FdmBoundaryConditionSet
static FdmSchemeDesc MethodOfLines(Real eps=0.001, Real relInitStepSize=0.01)
static FdmSchemeDesc TrBDF2()
FdmSchemeDesc(FdmSchemeType type, Real theta, Real mu)
static FdmSchemeDesc CrankNicolson()
static FdmSchemeDesc Douglas()
static FdmSchemeDesc CraigSneyd()
static FdmSchemeDesc ModifiedCraigSneyd()
static FdmSchemeDesc ExplicitEuler()
static FdmSchemeDesc ImplicitEuler()
static FdmSchemeDesc ModifiedHundsdorfer()
static FdmSchemeDesc Hundsdorfer()