QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmsquarerootfwdop.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) 2012, 2013 Klaus Spanderen
5 Copyright (C) 2014 Johannes Göttker-Schnetmann
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file fdmsquarerootfwdop.hpp
22 \brief Square root linear operator for the Fokker-Planck forward equation
23*/
24
25#ifndef quantlib_fdm_square_root_fwd_op_hpp
26#define quantlib_fdm_square_root_fwd_op_hpp
27
29
30namespace QuantLib {
31 class FdmMesher;
32 class SquareRootProcess;
33 class TripleBandLinearOp;
34 class ModTripleBandLinearOp;
35
37 public:
39
41 const ext::shared_ptr<FdmMesher>& mesher,
43 Size direction,
45
46 Size size() const override;
47 void setTime(Time t1, Time t2) override;
48
49 Array apply(const Array& r) const override;
50 Array apply_mixed(const Array& r) const override;
51 Array apply_direction(Size direction, const Array& r) const override;
52 Array solve_splitting(Size direction, const Array& r, Real s) const override;
53 Array preconditioner(const Array& r, Real s) const override;
54
55 std::vector<SparseMatrix> toMatrixDecomp() const override;
56
59 Real v(Size i) const;
60
61 private:
62 void setLowerBC(const ext::shared_ptr<FdmMesher>& mesher);
63 void setUpperBC(const ext::shared_ptr<FdmMesher>& mesher);
64
65 void getCoeff(Real& alpha, Real& beta,
66 Real& gamma, Size n) const;
68 Real& gamma, Size n) const;
70 Real& gamma, Size n) const;
72 Real& gamma, Size n) const;
73
74 Real f0Plain() const;
75 Real f1Plain() const;
76 Real f0Power() const;
77 Real f1Power() const;
78 Real f0Log() const;
79 Real f1Log() const;
80
81 Real h (Size i) const;
82 Real zetam(Size i) const;
83 Real zeta (Size i) const;
84 Real zetap(Size i) const;
85 Real mu (Size i) const;
86
90 ext::shared_ptr<ModTripleBandLinearOp> mapX_;
92 };
93}
94
95#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Array apply_direction(Size direction, const Array &r) const override
Array preconditioner(const Array &r, Real s) const override
void setLowerBC(const ext::shared_ptr< FdmMesher > &mesher)
std::vector< SparseMatrix > toMatrixDecomp() const override
void getCoeffLog(Real &alpha, Real &beta, Real &gamma, Size n) const
ext::shared_ptr< ModTripleBandLinearOp > mapX_
Real upperBoundaryFactor(TransformationType type=Plain) const
void setUpperBC(const ext::shared_ptr< FdmMesher > &mesher)
void setTime(Time t1, Time t2) override
Time is required.
void getCoeffPlain(Real &alpha, Real &beta, Real &gamma, Size n) const
Array apply_mixed(const Array &r) const override
void getCoeffPower(Real &alpha, Real &beta, Real &gamma, Size n) const
Array solve_splitting(Size direction, const Array &r, Real s) const override
const TransformationType transform_
Array apply(const Array &r) const override
void getCoeff(Real &alpha, Real &beta, Real &gamma, Size n) const
Real lowerBoundaryFactor(TransformationType type=Plain) const
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 kappa
Real theta
Real sigma
Definition: any.hpp:35
ext::shared_ptr< YieldTermStructure > r
ext::shared_ptr< BlackVolTermStructure > v
Real beta
Definition: sabr.cpp:200
Real alpha
Definition: sabr.cpp:200