21#include <ql/methods/finitedifferences/meshers/fdmmesher.hpp>
22#include <ql/methods/finitedifferences/operators/secondderivativeop.hpp>
29 const Real T,
const QuantLib::ext::shared_ptr<QuantLib::FdmMesher>& mesher,
30 const QuantLib::ext::shared_ptr<const DefaultableEquityJumpDiffusionModel>& model,
const Size direction)
31 : T_(T), mesher_(mesher), model_(model), direction_(direction), dxMap_(FirstDerivativeOp(direction, mesher)),
32 dxxMap_(SecondDerivativeOp(direction, mesher)), mapT_(direction, mesher), y_(mesher_->locations(direction_)) {}
45 for (Size i = 0; i < h.size(); ++i) {
46 Real S = std::exp(
y_[i]);
51 -(Array(n, r) + h * (1.0 -
model_->p())));
55 return mapT_.apply(r);
59 Array retVal(r.size(), 0.0);
64 const Array& r)
const {
66 return mapT_.apply(r);
68 Array retVal(r.size(), 0.0);
76 return mapT_.solve_splitting(r, s, 1.0);
87#if !defined(QL_NO_UBLAS_SUPPORT)
88std::vector<QuantLib::SparseMatrix>
90 std::vector<SparseMatrix> retVal(1,
mapT_.toMatrix());
QuantLib::ext::shared_ptr< const DefaultableEquityJumpDiffusionModel > model_
Size size() const override
QuantLib::TripleBandLinearOp dxxMap_
Array apply_direction(Size direction, const Array &r) const override
Array preconditioner(const Array &r, Real s) const override
QuantLib::ext::shared_ptr< QuantLib::FdmMesher > mesher_
std::vector< QuantLib::SparseMatrix > toMatrixDecomp() const override
void setTime(Time t1, Time t2) override
FdmDefaultableEquityJumpDiffusionFokkerPlanckOp(const Real T, const QuantLib::ext::shared_ptr< QuantLib::FdmMesher > &mesher, const QuantLib::ext::shared_ptr< const DefaultableEquityJumpDiffusionModel > &model, const Size direction=0)
this op is implemented in terms of time to maturity T, so that we can use a backward solver to evolve
Array apply_mixed(const Array &r) const override
Array solve_splitting(Size direction, const Array &r, Real s) const override
QuantLib::FirstDerivativeOp dxMap_
Array apply(const Array &r) const override
QuantLib::TripleBandLinearOp mapT_