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

Mersenne-twister Brownian generator for market-model simulations. More...

#include <mtbrowniangenerator.hpp>

+ Inheritance diagram for MTBrownianGenerator:
+ Collaboration diagram for MTBrownianGenerator:

Public Member Functions

 MTBrownianGenerator (Size factors, Size steps, unsigned long seed=0)
 
Real nextStep (std::vector< Real > &) override
 
Real nextPath () override
 
Size numberOfFactors () const override
 
Size numberOfSteps () const override
 
- Public Member Functions inherited from BrownianGenerator
virtual ~BrownianGenerator ()=default
 
virtual Real nextStep (std::vector< Real > &)=0
 
virtual Real nextPath ()=0
 
virtual Size numberOfFactors () const =0
 
virtual Size numberOfSteps () const =0
 

Private Attributes

Size factors_
 
Size steps_
 
Size lastStep_ = 0
 
RandomSequenceGenerator< MersenneTwisterUniformRnggenerator_
 
InverseCumulativeNormal inverseCumulative_
 

Detailed Description

Mersenne-twister Brownian generator for market-model simulations.

Incremental Brownian generator using a Mersenne-twister uniform generator and inverse-cumulative Gaussian method.

Note
At this time, generation of the underlying uniform sequence is eager, while its transformation into Gaussian variates is lazy. Further optimization might be possible by using the Mersenne twister directly instead of a RandomSequenceGenerator; however, it is not clear how much of a difference this would make when compared to the inverse-cumulative Gaussian calculation.

Definition at line 43 of file mtbrowniangenerator.hpp.

Constructor & Destructor Documentation

◆ MTBrownianGenerator()

MTBrownianGenerator ( Size  factors,
Size  steps,
unsigned long  seed = 0 
)

Definition at line 25 of file mtbrowniangenerator.cpp.

Member Function Documentation

◆ nextStep()

Real nextStep ( std::vector< Real > &  output)
overridevirtual

Implements BrownianGenerator.

Definition at line 29 of file mtbrowniangenerator.cpp.

+ Here is the call graph for this function:

◆ nextPath()

Real nextPath ( )
overridevirtual

Implements BrownianGenerator.

Definition at line 45 of file mtbrowniangenerator.cpp.

+ Here is the call graph for this function:

◆ numberOfFactors()

Size numberOfFactors ( ) const
overridevirtual

Implements BrownianGenerator.

Definition at line 54 of file mtbrowniangenerator.cpp.

◆ numberOfSteps()

Size numberOfSteps ( ) const
overridevirtual

Implements BrownianGenerator.

Definition at line 56 of file mtbrowniangenerator.cpp.

Member Data Documentation

◆ factors_

Size factors_
private

Definition at line 56 of file mtbrowniangenerator.hpp.

◆ steps_

Size steps_
private

Definition at line 56 of file mtbrowniangenerator.hpp.

◆ lastStep_

Size lastStep_ = 0
private

Definition at line 57 of file mtbrowniangenerator.hpp.

◆ generator_

Definition at line 58 of file mtbrowniangenerator.hpp.

◆ inverseCumulative_

InverseCumulativeNormal inverseCumulative_
private

Definition at line 59 of file mtbrowniangenerator.hpp.