QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmzabrop.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) 2014 Peter Caspers
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 fdmzabrop.hpp
21 \brief Zabr linear pricing operator
22*/
23
24#ifndef quantlib_fdm_zabr_op_hpp
25#define quantlib_fdm_zabr_op_hpp
26
32
33namespace QuantLib {
34
36 public:
38 const ext::shared_ptr<FdmMesher>& mesher, Real beta, Real nu, Real rho, Real gamma);
39
40 void setTime(Time t1, Time t2);
41 const TripleBandLinearOp &getMap() const;
42
43 protected:
47
48 const ext::shared_ptr<FdmMesher> mesher_;
49};
50
52 public:
54 const ext::shared_ptr<FdmMesher>& mesher, Real beta, Real nu, Real rho, Real gamma);
55
56 void setTime(Time t1, Time t2);
57 const TripleBandLinearOp &getMap() const;
58
59 protected:
63
64 const ext::shared_ptr<FdmMesher> mesher_;
65};
66
68 public:
69 FdmZabrOp(const ext::shared_ptr<FdmMesher>& mesher,
70 Real beta,
71 Real nu,
72 Real rho,
73 Real gamma = 1.0); // gamma=1.0 recovers the classic sabr model
74
75 Size size() const override;
76 void setTime(Time t1, Time t2) override;
77
78 Array apply(const Array& r) const override;
79 Array apply_mixed(const Array& r) const override;
80
81 Array apply_direction(Size direction, const Array& r) const override;
82 Array solve_splitting(Size direction, const Array& r, Real s) const override;
83 Array preconditioner(const Array& r, Real s) const override;
84
85 std::vector<SparseMatrix> toMatrixDecomp() const override;
86
87 private:
93};
94}
95
96#endif
1-D array used in linear algebra.
Definition: array.hpp:52
FdmZabrVolatilityPart dyMap_
Definition: fdmzabrop.hpp:92
Size size() const override
Definition: fdmzabrop.cpp:73
Array apply_direction(Size direction, const Array &r) const override
Definition: fdmzabrop.cpp:80
Array preconditioner(const Array &r, Real s) const override
Definition: fdmzabrop.cpp:105
std::vector< SparseMatrix > toMatrixDecomp() const override
Definition: fdmzabrop.cpp:109
void setTime(Time t1, Time t2) override
Time is required.
Definition: fdmzabrop.cpp:68
Array apply_mixed(const Array &r) const override
Definition: fdmzabrop.cpp:90
const Array volatilityValues_
Definition: fdmzabrop.hpp:88
Array solve_splitting(Size direction, const Array &r, Real s) const override
Definition: fdmzabrop.cpp:94
const Array forwardValues_
Definition: fdmzabrop.hpp:89
NinePointLinearOp dxyMap_
Definition: fdmzabrop.hpp:90
Array apply(const Array &r) const override
Definition: fdmzabrop.cpp:75
FdmZabrUnderlyingPart dxMap_
Definition: fdmzabrop.hpp:91
void setTime(Time t1, Time t2)
Definition: fdmzabrop.cpp:36
const TripleBandLinearOp & getMap() const
Definition: fdmzabrop.cpp:38
TripleBandLinearOp mapT_
Definition: fdmzabrop.hpp:46
const ext::shared_ptr< FdmMesher > mesher_
Definition: fdmzabrop.hpp:48
void setTime(Time t1, Time t2)
Definition: fdmzabrop.cpp:51
const TripleBandLinearOp & getMap() const
Definition: fdmzabrop.cpp:53
TripleBandLinearOp mapT_
Definition: fdmzabrop.hpp:62
const ext::shared_ptr< FdmMesher > mesher_
Definition: fdmzabrop.hpp:64
composite pattern for linear operators
mesher for a fdm grid
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
Real rho
Definition: any.hpp:35
nine point linear operator
ext::shared_ptr< YieldTermStructure > r
Real beta
Definition: sabr.cpp:200
Real nu
Definition: sabr.cpp:200
general triple band linear operator