QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
StochasticProcessArray Class Reference

Array of correlated 1-D stochastic processes More...

#include <ql/processes/stochasticprocessarray.hpp>

+ Inheritance diagram for StochasticProcessArray:
+ Collaboration diagram for StochasticProcessArray:

Public Member Functions

 StochasticProcessArray (const std::vector< ext::shared_ptr< StochasticProcess1D > > &, const Matrix &correlation)
 
Size size () const override
 returns the number of dimensions of the stochastic process More...
 
Array initialValues () const override
 returns the initial values of the state variables More...
 
Array drift (Time t, const Array &x) const override
 returns the drift part of the equation, i.e., \( \mu(t, \mathrm{x}_t) \) More...
 
Array expectation (Time t0, const Array &x0, Time dt) const override
 
Matrix diffusion (Time t, const Array &x) const override
 returns the diffusion part of the equation, i.e. \( \sigma(t, \mathrm{x}_t) \) More...
 
Matrix covariance (Time t0, const Array &x0, Time dt) const override
 
Matrix stdDeviation (Time t0, const Array &x0, Time dt) const override
 
Array apply (const Array &x0, const Array &dx) const override
 
Array evolve (Time t0, const Array &x0, Time dt, const Array &dw) const override
 
Time time (const Date &) const override
 
const ext::shared_ptr< StochasticProcess1D > & process (Size i) const
 
Matrix correlation () const
 
- Public Member Functions inherited from StochasticProcess
 ~StochasticProcess () override=default
 
virtual Size factors () const
 returns the number of independent factors of the process More...
 
void update () override
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 

Protected Attributes

std::vector< ext::shared_ptr< StochasticProcess1D > > processes_
 
Matrix sqrtCorrelation_
 
- Protected Attributes inherited from StochasticProcess
ext::shared_ptr< discretizationdiscretization_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from StochasticProcess
 StochasticProcess ()=default
 
 StochasticProcess (ext::shared_ptr< discretization >)
 

Detailed Description

Array of correlated 1-D stochastic processes

Definition at line 35 of file stochasticprocessarray.hpp.

Constructor & Destructor Documentation

◆ StochasticProcessArray()

StochasticProcessArray ( const std::vector< ext::shared_ptr< StochasticProcess1D > > &  processes,
const Matrix correlation 
)

Definition at line 26 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ size()

Size size ( ) const
overridevirtual

returns the number of dimensions of the stochastic process

Implements StochasticProcess.

Definition at line 42 of file stochasticprocessarray.cpp.

+ Here is the caller graph for this function:

◆ initialValues()

Array initialValues ( ) const
overridevirtual

returns the initial values of the state variables

Implements StochasticProcess.

Definition at line 46 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:

◆ drift()

Array drift ( Time  t,
const Array x 
) const
overridevirtual

returns the drift part of the equation, i.e., \( \mu(t, \mathrm{x}_t) \)

Implements StochasticProcess.

Definition at line 53 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expectation()

Array expectation ( Time  t0,
const Array x0,
Time  dt 
) const
overridevirtual

returns the expectation \( E(\mathrm{x}_{t_0 + \Delta t} | \mathrm{x}_{t_0} = \mathrm{x}_0) \) of the process after a time interval \( \Delta t \) according to the given discretization. This method can be overridden in derived classes which want to hard-code a particular discretization.

Reimplemented from StochasticProcess.

Definition at line 73 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ diffusion()

Matrix diffusion ( Time  t,
const Array x 
) const
overridevirtual

returns the diffusion part of the equation, i.e. \( \sigma(t, \mathrm{x}_t) \)

Implements StochasticProcess.

Definition at line 61 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:

◆ covariance()

Matrix covariance ( Time  t0,
const Array x0,
Time  dt 
) const
overridevirtual

returns the covariance \( V(\mathrm{x}_{t_0 + \Delta t} | \mathrm{x}_{t_0} = \mathrm{x}_0) \) of the process after a time interval \( \Delta t \) according to the given discretization. This method can be overridden in derived classes which want to hard-code a particular discretization.

Reimplemented from StochasticProcess.

Definition at line 95 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:

◆ stdDeviation()

Matrix stdDeviation ( Time  t0,
const Array x0,
Time  dt 
) const
overridevirtual

returns the standard deviation \( S(\mathrm{x}_{t_0 + \Delta t} | \mathrm{x}_{t_0} = \mathrm{x}_0) \) of the process after a time interval \( \Delta t \) according to the given discretization. This method can be overridden in derived classes which want to hard-code a particular discretization.

Reimplemented from StochasticProcess.

Definition at line 82 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply()

Array apply ( const Array x0,
const Array dx 
) const
overridevirtual

applies a change to the asset value. By default, it returns \( \mathrm{x} + \Delta \mathrm{x} \).

Reimplemented from StochasticProcess.

Definition at line 112 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evolve()

Array evolve ( Time  t0,
const Array x0,
Time  dt,
const Array dw 
) const
overridevirtual

returns the asset value after a time interval \( \Delta t \) according to the given discretization. By default, it returns

\[ E(\mathrm{x}_0,t_0,\Delta t) + S(\mathrm{x}_0,t_0,\Delta t) \cdot \Delta \mathrm{w} \]

where \( E \) is the expectation and \( S \) the standard deviation.

Reimplemented from StochasticProcess.

Definition at line 102 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ time()

Time time ( const Date ) const
overridevirtual

returns the time value corresponding to the given date in the reference system of the stochastic process.

Note
As a number of processes might not need this functionality, a default implementation is given which raises an exception.

Reimplemented from StochasticProcess.

Definition at line 120 of file stochasticprocessarray.cpp.

◆ process()

const ext::shared_ptr< StochasticProcess1D > & process ( Size  i) const

Definition at line 125 of file stochasticprocessarray.cpp.

+ Here is the caller graph for this function:

◆ correlation()

Matrix correlation ( ) const

Definition at line 129 of file stochasticprocessarray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ processes_

std::vector<ext::shared_ptr<StochasticProcess1D> > processes_
protected

Definition at line 58 of file stochasticprocessarray.hpp.

◆ sqrtCorrelation_

Matrix sqrtCorrelation_
protected

Definition at line 59 of file stochasticprocessarray.hpp.