QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fdmhestonfwdop.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2012, 2013, 2015 Klaus Spanderen
5 Copyright (C) 2014, 2015 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_heston_fwd_op_hpp
26#define quantlib_fdm_heston_fwd_op_hpp
27
28#include <ql/types.hpp>
29#include <ql/methods/finitedifferences/operators/fdmsquarerootfwdop.hpp>
30#include <ql/methods/finitedifferences/operators/fdmlinearopcomposite.hpp>
31#include <ql/termstructures/volatility/equityfx/localvoltermstructure.hpp>
32
33namespace QuantLib {
34
35 class YieldTermStructure;
36 class FdmMesher;
37 class HestonProcess;
38 class FirstDerivativeOp;
39 class TripleBandLinearOp;
40 class NinePointLinearOp;
41
43 public:
44 FdmHestonFwdOp(const ext::shared_ptr<FdmMesher>& mesher,
45 const ext::shared_ptr<HestonProcess>& process,
47 ext::shared_ptr<LocalVolTermStructure> leverageFct =
48 ext::shared_ptr<LocalVolTermStructure>(),
49 Real mixingFactor = 1.0);
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
57 Array apply_direction(Size direction, const Array& r) const override;
58 Array solve_splitting(Size direction, const Array& r, Real s) const override;
59 Array preconditioner(const Array& r, Real s) const override;
60
61 std::vector<SparseMatrix> toMatrixDecomp() const override;
62 private:
63 Array getLeverageFctSlice(Time t1, Time t2) const;
66
67 const ext::shared_ptr<YieldTermStructure> rTS_;
68 const ext::shared_ptr<YieldTermStructure> qTS_;
69
71 const ext::shared_ptr<FirstDerivativeOp> dxMap_;
72 const ext::shared_ptr<ModTripleBandLinearOp> dxxMap_;
73 const ext::shared_ptr<ModTripleBandLinearOp> boundary_;
75
76 const ext::shared_ptr<TripleBandLinearOp> mapX_;
77 const ext::shared_ptr<FdmSquareRootFwdOp> mapY_;
78
79 const ext::shared_ptr<NinePointLinearOp> correlation_;
80
81 const ext::shared_ptr<LocalVolTermStructure> leverageFct_;
82 const ext::shared_ptr<FdmMesher> mesher_;
83 const Array x_;
84 };
85}
86
87#endif
1-D array used in linear algebra.
Definition: array.hpp:52
const ext::shared_ptr< FirstDerivativeOp > dxMap_
Size size() const override
Array apply_direction(Size direction, const Array &r) const override
const ext::shared_ptr< NinePointLinearOp > correlation_
Array preconditioner(const Array &r, Real s) const override
std::vector< SparseMatrix > toMatrixDecomp() const override
const ext::shared_ptr< LocalVolTermStructure > leverageFct_
void setTime(Time t1, Time t2) override
Time is required.
const ext::shared_ptr< ModTripleBandLinearOp > boundary_
Array apply_mixed(const Array &r) const override
const ext::shared_ptr< YieldTermStructure > qTS_
const ext::shared_ptr< FdmMesher > mesher_
const ext::shared_ptr< TripleBandLinearOp > mapX_
Array getLeverageFctSlice(Time t1, Time t2) const
Array solve_splitting(Size direction, const Array &r, Real s) const override
const ext::shared_ptr< ModTripleBandLinearOp > dxxMap_
const ext::shared_ptr< YieldTermStructure > rTS_
const FdmSquareRootFwdOp::TransformationType type_
Array apply(const Array &r) const override
const ext::shared_ptr< FdmSquareRootFwdOp > mapY_
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