QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmcevop.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 fdmcevop.hpp
21 \brief FDM operator for the Constant Elasticity of Variance (CEV) model
22*/
23
24#ifndef quantlib_fdm_cev_op_hpp
25#define quantlib_fdm_cev_op_hpp
26
30
31namespace QuantLib {
32
33 //! constant elasticity of variance process (absorbing boundary at f=0)
34 /*! \f[
35 df_t = \alpha f_t^\beta \mathrm{d}W_t
36 \f]
37 */
38
39 class FdmMesher;
40 class YieldTermStructure;
41
43 public:
44
46 const ext::shared_ptr<FdmMesher>& mesher,
47 const ext::shared_ptr<YieldTermStructure>& rTS,
48 Real f0, Real alpha, Real beta,
49 Size direction);
50
51 Size size() const override;
52 void setTime(Time t1, Time t2) override;
53
54 Array apply(const Array& r) const override;
55 Array apply_mixed(const Array& r) const override;
56 Array apply_direction(Size direction, const Array& r) const override;
57 Array solve_splitting(Size direction, const Array& r, Real s) const override;
58 Array preconditioner(const Array& r, Real s) const override;
59
60 std::vector<SparseMatrix> toMatrixDecomp() const override;
61
62 private:
63 const ext::shared_ptr<YieldTermStructure>& rTS_;
67 };
68}
69
70#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Size size() const override
Definition: fdmcevop.cpp:45
Array apply_direction(Size direction, const Array &r) const override
Definition: fdmcevop.cpp:60
Array preconditioner(const Array &r, Real s) const override
Definition: fdmcevop.cpp:78
std::vector< SparseMatrix > toMatrixDecomp() const override
Definition: fdmcevop.cpp:82
const TripleBandLinearOp dxxMap_
Definition: fdmcevop.hpp:65
void setTime(Time t1, Time t2) override
Time is required.
Definition: fdmcevop.cpp:47
Array apply_mixed(const Array &r) const override
Definition: fdmcevop.cpp:56
TripleBandLinearOp mapT_
Definition: fdmcevop.hpp:66
const ext::shared_ptr< YieldTermStructure > & rTS_
Definition: fdmcevop.hpp:63
Array solve_splitting(Size direction, const Array &r, Real s) const override
Definition: fdmcevop.cpp:69
const Size direction_
Definition: fdmcevop.hpp:64
Array apply(const Array &r) const override
Definition: fdmcevop.cpp:52
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
Definition: any.hpp:35
nine point linear operator
ext::shared_ptr< YieldTermStructure > r
Real beta
Definition: sabr.cpp:200
Real alpha
Definition: sabr.cpp:200
general triple band linear operator