QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmhestonop.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Andreas Gaida
5 Copyright (C) 2008 Ralph Schreyer
6 Copyright (C) 2008, 2014, 2015 Klaus Spanderen
7 Copyright (C) 2015 Johannes Göttker-Schnetmann
8
9 This file is part of QuantLib, a free-software/open-source library
10 for financial quantitative analysts and developers - http://quantlib.org/
11
12 QuantLib is free software: you can redistribute it and/or modify it
13 under the terms of the QuantLib license. You should have received a
14 copy of the license along with this program; if not, please email
15 <quantlib-dev@lists.sf.net>. The license is also available online at
16 <http://quantlib.org/license.shtml>.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the license for more details.
21*/
22
23/*! \file fdmhestonop.hpp
24 \brief Heston linear operator
25*/
26
27#ifndef quantlib_fdm_heston_op_hpp
28#define quantlib_fdm_heston_op_hpp
29
37
38namespace QuantLib {
39
41 public:
42 FdmHestonEquityPart(const ext::shared_ptr<FdmMesher>& mesher,
43 ext::shared_ptr<YieldTermStructure> rTS,
44 ext::shared_ptr<YieldTermStructure> qTS,
45 ext::shared_ptr<FdmQuantoHelper> quantoHelper,
46 ext::shared_ptr<LocalVolTermStructure> leverageFct =
47 ext::shared_ptr<LocalVolTermStructure>());
48
49 void setTime(Time t1, Time t2);
50 const TripleBandLinearOp& getMap() const;
51 const Array& getL() const { return L_; }
52
53 protected:
54 Array getLeverageFctSlice(Time t1, Time t2) const;
55
60
61 const ext::shared_ptr<FdmMesher> mesher_;
62 const ext::shared_ptr<YieldTermStructure> rTS_, qTS_;
63 const ext::shared_ptr<FdmQuantoHelper> quantoHelper_;
64 const ext::shared_ptr<LocalVolTermStructure> leverageFct_;
65 };
66
68 public:
69 FdmHestonVariancePart(const ext::shared_ptr<FdmMesher>& mesher,
70 ext::shared_ptr<YieldTermStructure> rTS,
71 Real mixedSigma,
72 Real kappa,
73 Real theta);
74
75 void setTime(Time t1, Time t2);
76 const TripleBandLinearOp& getMap() const;
77
78 protected:
81
82 const ext::shared_ptr<YieldTermStructure> rTS_;
83 };
84
85
87 public:
88 FdmHestonOp(const ext::shared_ptr<FdmMesher>& mesher,
89 const ext::shared_ptr<HestonProcess>& hestonProcess,
90 const ext::shared_ptr<FdmQuantoHelper>& quantoHelper =
91 ext::shared_ptr<FdmQuantoHelper>(),
92 const ext::shared_ptr<LocalVolTermStructure>& leverageFct =
93 ext::shared_ptr<LocalVolTermStructure>(),
94 Real mixingFactor = 1.0);
95
96 Size size() const override;
97 void setTime(Time t1, Time t2) override;
98
99 Array apply(const Array& r) const override;
100 Array apply_mixed(const Array& r) const override;
101
102 Array apply_direction(Size direction, const Array& r) const override;
103 Array solve_splitting(Size direction, const Array& r, Real s) const override;
104 Array preconditioner(const Array& r, Real s) const override;
105
106 std::vector<SparseMatrix> toMatrixDecomp() const override;
107
108 private:
112 };
113}
114
115#endif
1-D array used in linear algebra.
Definition: array.hpp:52
void setTime(Time t1, Time t2)
Definition: fdmhestonop.cpp:54
const Array & getL() const
Definition: fdmhestonop.hpp:51
const TripleBandLinearOp & getMap() const
Definition: fdmhestonop.cpp:99
const TripleBandLinearOp dxxMap_
Definition: fdmhestonop.hpp:58
const ext::shared_ptr< FdmQuantoHelper > quantoHelper_
Definition: fdmhestonop.hpp:63
const ext::shared_ptr< LocalVolTermStructure > leverageFct_
Definition: fdmhestonop.hpp:64
TripleBandLinearOp mapT_
Definition: fdmhestonop.hpp:59
const ext::shared_ptr< YieldTermStructure > qTS_
Definition: fdmhestonop.hpp:62
const FirstDerivativeOp dxMap_
Definition: fdmhestonop.hpp:57
const ext::shared_ptr< FdmMesher > mesher_
Definition: fdmhestonop.hpp:61
Array getLeverageFctSlice(Time t1, Time t2) const
Definition: fdmhestonop.cpp:72
const ext::shared_ptr< YieldTermStructure > rTS_
Definition: fdmhestonop.hpp:62
Size size() const override
FdmHestonEquityPart dxMap_
FdmHestonVariancePart dyMap_
Array apply_direction(Size direction, const Array &r) const override
Array preconditioner(const Array &r, Real s) const override
std::vector< SparseMatrix > toMatrixDecomp() const override
void setTime(Time t1, Time t2) override
Time is required.
Array apply_mixed(const Array &r) const override
NinePointLinearOp correlationMap_
Array solve_splitting(Size direction, const Array &r, Real s) const override
Array apply(const Array &r) const override
void setTime(Time t1, Time t2)
const TripleBandLinearOp & getMap() const
const TripleBandLinearOp dyMap_
Definition: fdmhestonop.hpp:79
const ext::shared_ptr< YieldTermStructure > rTS_
Definition: fdmhestonop.hpp:82
composite pattern for linear operators
helper class storing market data needed for the quanto adjustment.
first derivative linear operator
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Heston stochastic process.
Real kappa
Real theta
Local volatility term structure base class.
Definition: any.hpp:35
nine point linear operator
ext::shared_ptr< YieldTermStructure > r
general triple band linear operator