QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BrownianBridge Class Reference

Builds Wiener process paths using Gaussian variates. More...

#include <brownianbridge.hpp>

+ Collaboration diagram for BrownianBridge:

Public Member Functions

 BrownianBridge (Size steps)
 
 BrownianBridge (const std::vector< Time > &times)
 
 BrownianBridge (const TimeGrid &timeGrid)
 

inspectors

Size size_
 
std::vector< Timet_
 
std::vector< Realsqrtdt_
 
std::vector< SizebridgeIndex_
 
std::vector< SizeleftIndex_
 
std::vector< SizerightIndex_
 
std::vector< RealleftWeight_
 
std::vector< RealrightWeight_
 
std::vector< RealstdDev_
 
Size size () const
 
const std::vector< Time > & times () const
 
const std::vector< Size > & bridgeIndex () const
 
const std::vector< Size > & leftIndex () const
 
const std::vector< Size > & rightIndex () const
 
const std::vector< Real > & leftWeight () const
 
const std::vector< Real > & rightWeight () const
 
const std::vector< Real > & stdDeviation () const
 
template<class RandomAccessIterator1 , class RandomAccessIterator2 >
void transform (RandomAccessIterator1 begin, RandomAccessIterator1 end, RandomAccessIterator2 output) const
 Brownian-bridge generator function. More...
 
void initialize ()
 

Detailed Description

Builds Wiener process paths using Gaussian variates.

This class generates normalized (i.e., unit-variance) paths as sequences of variations. In order to obtain the actual path of the underlying, the returned variations must be multiplied by the integrated variance (including time) over the corresponding time step.

Definition at line 53 of file brownianbridge.hpp.

Constructor & Destructor Documentation

◆ BrownianBridge() [1/3]

BrownianBridge ( Size  steps)

The constructor generates the time grid so that each step is of unit-time length.

Parameters
stepsThe number of steps in the path

Definition at line 34 of file brownianbridge.cpp.

+ Here is the call graph for this function:

◆ BrownianBridge() [2/3]

BrownianBridge ( const std::vector< Time > &  times)

The step times are copied from the supplied vector

Parameters
timesA vector containing the times at which the steps occur. This also defines the number of steps that will be generated.
Note
the starting time of the path is assumed to be 0 and must not be included

Definition at line 43 of file brownianbridge.cpp.

+ Here is the call graph for this function:

◆ BrownianBridge() [3/3]

BrownianBridge ( const TimeGrid timeGrid)

The step times are copied from the TimeGrid object

Parameters
timeGrida time grid containing the times at which the steps will occur

Definition at line 50 of file brownianbridge.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ size()

Size size ( ) const

Definition at line 79 of file brownianbridge.hpp.

◆ times()

const std::vector< Time > & times ( ) const

Definition at line 80 of file brownianbridge.hpp.

◆ bridgeIndex()

const std::vector< Size > & bridgeIndex ( ) const

Definition at line 81 of file brownianbridge.hpp.

◆ leftIndex()

const std::vector< Size > & leftIndex ( ) const

Definition at line 82 of file brownianbridge.hpp.

◆ rightIndex()

const std::vector< Size > & rightIndex ( ) const

Definition at line 83 of file brownianbridge.hpp.

◆ leftWeight()

const std::vector< Real > & leftWeight ( ) const

Definition at line 84 of file brownianbridge.hpp.

◆ rightWeight()

const std::vector< Real > & rightWeight ( ) const

Definition at line 85 of file brownianbridge.hpp.

◆ stdDeviation()

const std::vector< Real > & stdDeviation ( ) const

Definition at line 86 of file brownianbridge.hpp.

◆ transform()

void transform ( RandomAccessIterator1  begin,
RandomAccessIterator1  end,
RandomAccessIterator2  output 
) const

Brownian-bridge generator function.

Transforms an input sequence of random variates into a sequence of variations in a Brownian bridge path.

Parameters
beginThe start iterator of the input sequence.
endThe end iterator of the input sequence.
outputThe start iterator of the output sequence.
Note
To get the canonical Brownian bridge which starts and finishes at the same value, the first element of the input sequence must be zero. Conversely, to get a sloped bridge set the first element to a non-zero value. In this case, the final value in the bridge will be sqrt(last time point)*(first element of input sequence).

Definition at line 107 of file brownianbridge.hpp.

+ Here is the caller graph for this function:

◆ initialize()

void initialize ( )
private

Definition at line 60 of file brownianbridge.cpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ size_

Size size_
private

Definition at line 140 of file brownianbridge.hpp.

◆ t_

std::vector<Time> t_
private

Definition at line 141 of file brownianbridge.hpp.

◆ sqrtdt_

std::vector<Real> sqrtdt_
private

Definition at line 142 of file brownianbridge.hpp.

◆ bridgeIndex_

std::vector<Size> bridgeIndex_
private

Definition at line 143 of file brownianbridge.hpp.

◆ leftIndex_

std::vector<Size> leftIndex_
private

Definition at line 143 of file brownianbridge.hpp.

◆ rightIndex_

std::vector<Size> rightIndex_
private

Definition at line 143 of file brownianbridge.hpp.

◆ leftWeight_

std::vector<Real> leftWeight_
private

Definition at line 144 of file brownianbridge.hpp.

◆ rightWeight_

std::vector<Real> rightWeight_
private

Definition at line 144 of file brownianbridge.hpp.

◆ stdDev_

std::vector<Real> stdDev_
private

Definition at line 144 of file brownianbridge.hpp.