QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
endeulerdiscretization.cpp
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) 2008 Frank Hövermann
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
21
22namespace QuantLib {
23
25 Time t0, const Array& x0,
26 Time dt) const {
27 return process.drift(t0+dt, x0)*dt;
28 }
29
31 Time t0, Real x0, Time dt) const {
32 return process.drift(t0+dt, x0)*dt;
33 }
34
36 Time t0,
37 const Array& x0,
38 Time dt) const {
39 return process.diffusion(t0+dt, x0) * std::sqrt(dt);
40 }
41
43 Time t0, Real x0, Time dt) const {
44 return process.diffusion(t0+dt, x0) * std::sqrt(dt);
45 }
46
48 Time t0,
49 const Array& x0,
50 Time dt) const {
51 Matrix sigma = process.diffusion(t0+dt, x0);
52 Matrix result = sigma*transpose(sigma)*dt;
53 return result;
54 }
55
57 Time t0, Real x0, Time dt) const {
58 Real sigma = process.diffusion(t0+dt, x0);
59 return sigma*sigma*dt;
60 }
61
62}
63
1-D array used in linear algebra.
Definition: array.hpp:52
Matrix diffusion(const StochasticProcess &, Time t0, const Array &x0, Time dt) const override
Real variance(const StochasticProcess1D &, Time t0, Real x0, Time dt) const override
Matrix covariance(const StochasticProcess &, Time t0, const Array &x0, Time dt) const override
Array drift(const StochasticProcess &, Time t0, const Array &x0, Time dt) const override
Matrix used in linear algebra.
Definition: matrix.hpp:41
1-dimensional stochastic process
virtual Real drift(Time t, Real x) const =0
returns the drift part of the equation, i.e.
virtual Real diffusion(Time t, Real x) const =0
returns the diffusion part of the equation, i.e.
multi-dimensional stochastic process class.
virtual Array drift(Time t, const Array &x) const =0
returns the drift part of the equation, i.e.,
virtual Matrix diffusion(Time t, const Array &x) const =0
returns the diffusion part of the equation, i.e.
Euler end-point discretization for stochastic processes.
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Real sigma
Definition: any.hpp:35
Matrix transpose(const Matrix &m)
Definition: matrix.hpp:700