Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fdmdefaultableequityjumpdiffusionfokkerplanckop.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/methods/fdmdefaultableequityjumpdiffusionfokkerplanckop.hpp */
20
21#pragma once
22
24#include <ql/methods/finitedifferences/operators/fdmlinearopcomposite.hpp>
25#include <ql/methods/finitedifferences/operators/firstderivativeop.hpp>
26#include <ql/methods/finitedifferences/operators/triplebandlinearop.hpp>
27
28#include <functional>
29
30namespace QuantExt {
31
32using QuantLib::Array;
33using QuantLib::Size;
34
35class FdmDefaultableEquityJumpDiffusionFokkerPlanckOp : public QuantLib::FdmLinearOpComposite {
36public:
37 //! this op is implemented in terms of time to maturity T, so that we can use a backward solver to evolve
39 const Real T, const QuantLib::ext::shared_ptr<QuantLib::FdmMesher>& mesher,
40 const QuantLib::ext::shared_ptr<const DefaultableEquityJumpDiffusionModel>& model, const Size direction = 0);
41
42 Size size() const override;
43 void setTime(Time t1, Time t2) override;
44
45 Array apply(const Array& r) const override;
46 Array apply_mixed(const Array& r) const override;
47 Array apply_direction(Size direction, const Array& r) const override;
48 Array solve_splitting(Size direction, const Array& r, Real s) const override;
49 Array preconditioner(const Array& r, Real s) const override;
50
51#if !defined(QL_NO_UBLAS_SUPPORT)
52 std::vector<QuantLib::SparseMatrix> toMatrixDecomp() const override;
53#endif
54
55private:
56 Real T_;
57 QuantLib::ext::shared_ptr<QuantLib::FdmMesher> mesher_;
58 QuantLib::ext::shared_ptr<const DefaultableEquityJumpDiffusionModel> model_;
60
61 QuantLib::FirstDerivativeOp dxMap_;
62 QuantLib::TripleBandLinearOp dxxMap_;
63 QuantLib::TripleBandLinearOp mapT_;
64
65 Array y_;
66};
67
68} // namespace QuantExt
QuantLib::ext::shared_ptr< const DefaultableEquityJumpDiffusionModel > model_
Array solve_splitting(Size direction, const Array &r, Real s) const override