QuantLib: BrownianBridge Class Reference

A free/open-source library for quantitative finance Reference manual - version 1.20

Public Member Functions | List of all members
BrownianBridge Class Reference
Monte Carlo framework

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

`#include <ql/methods/montecarlo/brownianbridge.hpp>`

## Public Member Functions
| BrownianBridge (Size steps)
| BrownianBridge (const std::vector< Time > &times)
| BrownianBridge (const TimeGrid &timeGrid)

## inspectors
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...

## 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.

## 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

  steps | The number of steps in the path

## ◆ BrownianBridge() [2/3]

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

The step times are copied from the supplied vector

Parameters

  times | A 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

## ◆ BrownianBridge() [3/3]

BrownianBridge | ( | const TimeGrid & | timeGrid | ) |

The step times are copied from the TimeGrid object

Parameters

  timeGrid | a time grid containing the times at which the steps will occur

## Member Function Documentation

## ◆ 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

  begin | The start iterator of the input sequence.
  end | The end iterator of the input sequence.
  output | The 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).