QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fdmsquarerootfwdop.hpp
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
25#ifndef quantlib_fdm_square_root_fwd_op_hpp
26#define quantlib_fdm_square_root_fwd_op_hpp
27
28#include <ql/methods/finitedifferences/operators/fdmlinearopcomposite.hpp>
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,
42 Real kappa, Real theta, Real sigma,
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;
67 void getCoeffPlain(Real& alpha, Real& beta,
68 Real& gamma, Size n) const;
69 void getCoeffPower(Real& alpha, Real& beta,
70 Real& gamma, Size n) const;
71 void getCoeffLog(Real& alpha, Real& beta,
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
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
Definition: any.hpp:35