QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmg2op.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) 2011 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 fdmg2op.hpp
21 \brief FDM G2 operator
22*/
23
24#ifndef quantlib_fdm_g2_op_hpp
25#define quantlib_fdm_g2_op_hpp
26
30
31namespace QuantLib {
32
33 class G2;
34 class FdmMesher;
35
37 public:
38
39 FdmG2Op(
40 const ext::shared_ptr<FdmMesher>& mesher,
41 const ext::shared_ptr<G2>& model,
42 Size direction1, Size direction2);
43
44 Size size() const override;
45 void setTime(Time t1, Time t2) override;
46
47 Array apply(const Array& r) const override;
48 Array apply_mixed(const Array& r) const override;
49 Array apply_direction(Size direction, const Array& r) const override;
50 Array solve_splitting(Size direction, const Array& r, Real s) const override;
51 Array preconditioner(const Array& r, Real s) const override;
52
53 std::vector<SparseMatrix> toMatrixDecomp() const override;
54
55 private:
57 const Array x_, y_;
59
62
63 const ext::shared_ptr<G2> model_;
64 };
65}
66
67#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Size size() const override
Definition: fdmg2op.cpp:58
const TripleBandLinearOp dxMap_
Definition: fdmg2op.hpp:58
Array apply_direction(Size direction, const Array &r) const override
Definition: fdmg2op.cpp:81
Array preconditioner(const Array &r, Real s) const override
Definition: fdmg2op.cpp:105
std::vector< SparseMatrix > toMatrixDecomp() const override
Definition: fdmg2op.cpp:109
const Array x_
Definition: fdmg2op.hpp:57
const TripleBandLinearOp dyMap_
Definition: fdmg2op.hpp:58
void setTime(Time t1, Time t2) override
Time is required.
Definition: fdmg2op.cpp:60
Array apply_mixed(const Array &r) const override
Definition: fdmg2op.cpp:77
Array solve_splitting(Size direction, const Array &r, Real s) const override
Definition: fdmg2op.cpp:93
const Array y_
Definition: fdmg2op.hpp:57
NinePointLinearOp corrMap_
Definition: fdmg2op.hpp:60
const Size direction1_
Definition: fdmg2op.hpp:56
Array apply(const Array &r) const override
Definition: fdmg2op.cpp:73
TripleBandLinearOp mapY_
Definition: fdmg2op.hpp:61
const ext::shared_ptr< G2 > model_
Definition: fdmg2op.hpp:63
const Size direction2_
Definition: fdmg2op.hpp:56
TripleBandLinearOp mapX_
Definition: fdmg2op.hpp:61
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
general triple band linear operator