QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmsabrop.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) 2018 Klaus Spanderen
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 fdmsabrop.hpp
21 \brief FDM operator for the SABR model
22*/
23
24#ifndef quantlib_fdm_sabr_op_hpp
25#define quantlib_fdm_sabr_op_hpp
26
30
31namespace QuantLib {
32
33 //! SABR model with absorbing boundary at f=0
34 /*! \f[
35 df_t = \alpha_t f_t^\beta \mathrm{d}W_t \\
36 d\alpha_t = \nu \alpha_t \mathrm{d}Z_t \\
37 \rho \mathrm{d}t = < \mathrm{d}W_t, \mathrm{d}Z_t >
38 \f]
39 */
40
41
42 class FdmMesher;
43 class YieldTermStructure;
44
46 public:
47 FdmSabrOp(const ext::shared_ptr<FdmMesher>& mesher,
48 ext::shared_ptr<YieldTermStructure> rTS,
49 Real f0,
50 Real alpha,
51 Real beta,
52 Real nu,
53 Real rho);
54
55 Size size() const override;
56 void setTime(Time t1, Time t2) override;
57
58 Array apply(const Array& r) const override;
59 Array apply_mixed(const Array& r) const override;
60 Array apply_direction(Size direction, const Array& r) const override;
61 Array solve_splitting(Size direction, const Array& r, Real s) const override;
62 Array preconditioner(const Array& r, Real s) const override;
63
64 std::vector<SparseMatrix> toMatrixDecomp() const override;
65
66 private:
67 const ext::shared_ptr<YieldTermStructure> rTS_;
68
72
74 };
75}
76
77#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Size size() const override
Definition: fdmsabrop.cpp:58
const TripleBandLinearOp dxMap_
Definition: fdmsabrop.hpp:70
Array apply_direction(Size direction, const Array &r) const override
Definition: fdmsabrop.cpp:70
Array preconditioner(const Array &r, Real s) const override
Definition: fdmsabrop.cpp:93
std::vector< SparseMatrix > toMatrixDecomp() const override
Definition: fdmsabrop.cpp:99
const TripleBandLinearOp dxxMap_
Definition: fdmsabrop.hpp:70
void setTime(Time t1, Time t2) override
Time is required.
Definition: fdmsabrop.cpp:51
Array apply_mixed(const Array &r) const override
Definition: fdmsabrop.cpp:66
const TripleBandLinearOp dffMap_
Definition: fdmsabrop.hpp:69
Array solve_splitting(Size direction, const Array &r, Real s) const override
Definition: fdmsabrop.cpp:80
const ext::shared_ptr< YieldTermStructure > rTS_
Definition: fdmsabrop.hpp:67
Array apply(const Array &r) const override
Definition: fdmsabrop.cpp:62
TripleBandLinearOp mapF_
Definition: fdmsabrop.hpp:73
TripleBandLinearOp mapA_
Definition: fdmsabrop.hpp:73
const NinePointLinearOp correlationMap_
Definition: fdmsabrop.hpp:71
composite pattern for linear operators
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
Real alpha
Definition: sabr.cpp:200
general triple band linear operator