Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fdmlgmop.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2024 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 fdmlgmop.hpp
20 \brief finite difference operator LGM model
21
22*/
23
24#pragma once
25
26#include <ql/methods/finitedifferences/operators/fdmlinearopcomposite.hpp>
27#include <ql/methods/finitedifferences/operators/firstderivativeop.hpp>
28#include <ql/methods/finitedifferences/operators/triplebandlinearop.hpp>
29#include <ql/stochasticprocess.hpp>
30
31namespace QuantExt {
32using namespace QuantLib;
33
34class FdmLgmOp : public FdmLinearOpComposite {
35public:
36 FdmLgmOp(const ext::shared_ptr<FdmMesher>& mesher, const ext::shared_ptr<StochasticProcess1D>& process);
37
38 Size size() const override;
39 void setTime(Time t1, Time t2) override;
40
41 Array apply(const Array& r) const override;
42 Array apply_mixed(const Array& r) const override;
43 Array apply_direction(Size direction, const Array& r) const override;
44 Array solve_splitting(Size direction, const Array& r, Real s) const override;
45 Array preconditioner(const Array& r, Real s) const override;
46
47#if !defined(QL_NO_UBLAS_SUPPORT)
48 std::vector<QuantLib::SparseMatrix> toMatrixDecomp() const override;
49#endif
50private:
51 ext::shared_ptr<FdmMesher> mesher_;
52 ext::shared_ptr<StochasticProcess1D> process_;
53 FirstDerivativeOp dxMap_;
54 TripleBandLinearOp dxxMap_;
55 TripleBandLinearOp mapT_;
56};
57} // namespace QuantExt
Size size() const override
Definition: fdmlgmop.cpp:36
Array apply_direction(Size direction, const Array &r) const override
Definition: fdmlgmop.cpp:40
Array preconditioner(const Array &r, Real s) const override
Definition: fdmlgmop.cpp:63
TripleBandLinearOp dxxMap_
Definition: fdmlgmop.hpp:54
std::vector< QuantLib::SparseMatrix > toMatrixDecomp() const override
Definition: fdmlgmop.cpp:66
ext::shared_ptr< StochasticProcess1D > process_
Definition: fdmlgmop.hpp:52
void setTime(Time t1, Time t2) override
Definition: fdmlgmop.cpp:31
Array apply_mixed(const Array &r) const override
Definition: fdmlgmop.cpp:49
TripleBandLinearOp mapT_
Definition: fdmlgmop.hpp:55
Array solve_splitting(Size direction, const Array &r, Real s) const override
Definition: fdmlgmop.cpp:54
Array apply(const Array &r) const override
Definition: fdmlgmop.cpp:38
ext::shared_ptr< FdmMesher > mesher_
Definition: fdmlgmop.hpp:51
FirstDerivativeOp dxMap_
Definition: fdmlgmop.hpp:53