QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
g2process.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 Banca Profilo S.p.A.
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
24#ifndef quantlib_g2_process_hpp
25#define quantlib_g2_process_hpp
26
27#include <ql/processes/forwardmeasureprocess.hpp>
28#include <ql/processes/ornsteinuhlenbeckprocess.hpp>
29
30namespace QuantLib {
31
33
35 public:
38
39 Size size() const override;
40 Array initialValues() const override;
41 Array drift(Time t, const Array& x) const override;
42 Matrix diffusion(Time t, const Array& x) const override;
43 Array expectation(Time t0, const Array& x0, Time dt) const override;
44 Matrix stdDeviation(Time t0, const Array& x0, Time dt) const override;
45 Matrix covariance(Time t0, const Array& x0, Time dt) const override;
47 Real x0() const;
48 Real y0() const;
49 Real a() const;
50 Real sigma() const;
51 Real b() const;
52 Real eta() const;
53 Real rho() const;
54 private:
55 Real x0_ = 0.0, y0_ = 0.0, a_, sigma_, b_, eta_, rho_;
56 ext::shared_ptr<QuantLib::OrnsteinUhlenbeckProcess> xProcess_;
57 ext::shared_ptr<QuantLib::OrnsteinUhlenbeckProcess> yProcess_;
58 };
59
61
63 public:
64 G2ForwardProcess(Real a, Real sigma, Real b, Real eta, Real rho);
66
67 Size size() const override;
68 Array initialValues() const override;
69 Array drift(Time t, const Array& x) const override;
70 Matrix diffusion(Time t, const Array& x) const override;
71 Array expectation(Time t0, const Array& x0, Time dt) const override;
72 Matrix stdDeviation(Time t0, const Array& x0, Time dt) const override;
73 Matrix covariance(Time t0, const Array& x0, Time dt) const override;
75 protected:
76 Real x0_ = 0.0, y0_ = 0.0, a_, sigma_, b_, eta_, rho_;
77 ext::shared_ptr<QuantLib::OrnsteinUhlenbeckProcess> xProcess_;
78 ext::shared_ptr<QuantLib::OrnsteinUhlenbeckProcess> yProcess_;
79 Real xForwardDrift(Time t, Time T) const;
80 Real yForwardDrift(Time t, Time T) const;
81 Real Mx_T(Real s, Real t, Real T) const;
82 Real My_T(Real s, Real t, Real T) const;
83 };
84
85}
86
87
88#endif
89
1-D array used in linear algebra.
Definition: array.hpp:52
forward-measure stochastic process
Forward G2 stochastic process
Definition: g2process.hpp:62
ext::shared_ptr< QuantLib::OrnsteinUhlenbeckProcess > xProcess_
Definition: g2process.hpp:77
Array drift(Time t, const Array &x) const override
returns the drift part of the equation, i.e.,
Definition: g2process.cpp:140
Size size() const override
returns the number of dimensions of the stochastic process
Definition: g2process.cpp:132
ext::shared_ptr< QuantLib::OrnsteinUhlenbeckProcess > yProcess_
Definition: g2process.hpp:78
Matrix diffusion(Time t, const Array &x) const override
returns the diffusion part of the equation, i.e.
Definition: g2process.cpp:147
Matrix stdDeviation(Time t0, const Array &x0, Time dt) const override
Definition: g2process.cpp:164
Real My_T(Real s, Real t, Real T) const
Definition: g2process.cpp:213
Real yForwardDrift(Time t, Time T) const
Definition: g2process.cpp:194
Real Mx_T(Real s, Real t, Real T) const
Definition: g2process.cpp:202
Matrix covariance(Time t0, const Array &x0, Time dt) const override
Definition: g2process.cpp:180
Array expectation(Time t0, const Array &x0, Time dt) const override
Definition: g2process.cpp:156
Array initialValues() const override
returns the initial values of the state variables
Definition: g2process.cpp:136
Real xForwardDrift(Time t, Time T) const
Definition: g2process.cpp:186
G2 stochastic process
Definition: g2process.hpp:34
ext::shared_ptr< QuantLib::OrnsteinUhlenbeckProcess > xProcess_
Definition: g2process.hpp:56
Array drift(Time t, const Array &x) const override
returns the drift part of the equation, i.e.,
Definition: g2process.cpp:38
Size size() const override
returns the number of dimensions of the stochastic process
Definition: g2process.cpp:30
ext::shared_ptr< QuantLib::OrnsteinUhlenbeckProcess > yProcess_
Definition: g2process.hpp:57
Real b() const
Definition: g2process.cpp:114
Real sigma() const
Definition: g2process.cpp:110
Matrix diffusion(Time t, const Array &x) const override
returns the diffusion part of the equation, i.e.
Definition: g2process.cpp:45
Matrix stdDeviation(Time t0, const Array &x0, Time dt) const override
Definition: g2process.cpp:69
Real rho() const
Definition: g2process.cpp:122
Real a() const
Definition: g2process.cpp:106
Matrix covariance(Time t0, const Array &x0, Time dt) const override
Definition: g2process.cpp:92
Array expectation(Time t0, const Array &x0, Time dt) const override
Definition: g2process.cpp:61
Real y0() const
Definition: g2process.cpp:102
Array initialValues() const override
returns the initial values of the state variables
Definition: g2process.cpp:34
Real eta() const
Definition: g2process.cpp:118
Real x0() const
Definition: g2process.cpp:98
Matrix used in linear algebra.
Definition: matrix.hpp:41
multi-dimensional stochastic process class.
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