QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmcirop.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) 2020 Lew Wei Hao
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file fdmcirop.hpp
21 \brief CIR linear operator
22*/
23
24#ifndef quantlib_fdm_cir_op_hpp
25#define quantlib_fdm_cir_op_hpp
26
37
38namespace QuantLib {
39
41 public:
43 const ext::shared_ptr<FdmMesher>& mesher,
44 const ext::shared_ptr<GeneralizedBlackScholesProcess> & bsProcess,
45 Real strike);
46
47 void setTime(Time t1, Time t2);
48 const TripleBandLinearOp& getMap() const;
49
50 protected:
54
55 const ext::shared_ptr<FdmMesher> mesher_;
56 const ext::shared_ptr<YieldTermStructure> qTS_;
58 const ext::shared_ptr<BlackVolTermStructure> sigma1_;
59 };
60
62 public:
64 const ext::shared_ptr<FdmMesher>& mesher,
66
67 void setTime(Time t1, Time t2);
68 const TripleBandLinearOp& getMap() const;
69
70 protected:
73 const ext::shared_ptr<FdmMesher> mesher_;
74 };
75
77 public:
78 FdmCIRMixedPart(const ext::shared_ptr<FdmMesher>& mesher,
79 const ext::shared_ptr<CoxIngersollRossProcess>& cirProcess,
80 const ext::shared_ptr<GeneralizedBlackScholesProcess>& bsProcess,
81 Real rho,
82 Real strike);
83
84 void setTime(Time t1, Time t2);
85 const NinePointLinearOp& getMap() const;
86
87 protected:
90 const ext::shared_ptr<FdmMesher> mesher_;
91 const ext::shared_ptr<BlackVolTermStructure> sigma1_;
93 };
94
95
97 public:
98 FdmCIROp(const ext::shared_ptr<FdmMesher>& mesher,
99 const ext::shared_ptr<CoxIngersollRossProcess>& cirProcess,
100 const ext::shared_ptr<GeneralizedBlackScholesProcess>& bsProcess,
101 Real rho,
102 Real strike);
103
104 Size size() const override;
105 void setTime(Time t1, Time t2) override;
106
107 Array apply(const Array& r) const override;
108 Array apply_mixed(const Array& r) const override;
109
110 Array apply_direction(Size direction, const Array& r) const override;
111 Array solve_splitting(Size direction, const Array& r, Real s) const override;
112 Array preconditioner(const Array& r, Real s) const override;
113
114 std::vector<SparseMatrix> toMatrixDecomp() const override;
115
116 private:
120 };
121}
122
123#endif
Black-Scholes processes.
1-D array used in linear algebra.
Definition: array.hpp:52
void setTime(Time t1, Time t2)
Definition: fdmcirop.cpp:42
const TripleBandLinearOp & getMap() const
Definition: fdmcirop.cpp:51
const TripleBandLinearOp dxxMap_
Definition: fdmcirop.hpp:52
TripleBandLinearOp mapT_
Definition: fdmcirop.hpp:53
const ext::shared_ptr< YieldTermStructure > qTS_
Definition: fdmcirop.hpp:56
const FirstDerivativeOp dxMap_
Definition: fdmcirop.hpp:51
const ext::shared_ptr< FdmMesher > mesher_
Definition: fdmcirop.hpp:55
const ext::shared_ptr< BlackVolTermStructure > sigma1_
Definition: fdmcirop.hpp:58
void setTime(Time t1, Time t2)
Definition: fdmcirop.cpp:88
const NinePointLinearOp & getMap() const
Definition: fdmcirop.cpp:94
const ext::shared_ptr< FdmMesher > mesher_
Definition: fdmcirop.hpp:90
const NinePointLinearOp dyMap_
Definition: fdmcirop.hpp:88
const ext::shared_ptr< BlackVolTermStructure > sigma1_
Definition: fdmcirop.hpp:91
NinePointLinearOp mapT_
Definition: fdmcirop.hpp:89
Size size() const override
Definition: fdmcirop.cpp:125
Array apply_direction(Size direction, const Array &r) const override
Definition: fdmcirop.cpp:137
Array preconditioner(const Array &r, Real s) const override
Definition: fdmcirop.cpp:163
std::vector< SparseMatrix > toMatrixDecomp() const override
Definition: fdmcirop.cpp:167
FdmCIREquityPart dxMap_
Definition: fdmcirop.hpp:117
void setTime(Time t1, Time t2) override
Time is required.
Definition: fdmcirop.cpp:119
Array apply_mixed(const Array &r) const override
Definition: fdmcirop.cpp:147
FdmCIRMixedPart dzMap_
Definition: fdmcirop.hpp:119
Array solve_splitting(Size direction, const Array &r, Real s) const override
Definition: fdmcirop.cpp:151
Array apply(const Array &r) const override
Definition: fdmcirop.cpp:129
FdmCIRRatesPart dyMap_
Definition: fdmcirop.hpp:118
void setTime(Time t1, Time t2)
Definition: fdmcirop.cpp:66
const TripleBandLinearOp & getMap() const
Definition: fdmcirop.cpp:70
const TripleBandLinearOp dyMap_
Definition: fdmcirop.hpp:71
TripleBandLinearOp mapT_
Definition: fdmcirop.hpp:72
const ext::shared_ptr< FdmMesher > mesher_
Definition: fdmcirop.hpp:73
Cox-Ingersoll-Ross model.
CoxIngersollRoss process.
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
Real rho
Real sigma
Local volatility term structure base class.
Definition: any.hpp:35
nine point linear operator
ext::shared_ptr< YieldTermStructure > r
general triple band linear operator