QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
InverseCumulativeRsg< USG, IC > Class Template Reference

Inverse cumulative random sequence generator. More...

#include <inversecumulativersg.hpp>

+ Inheritance diagram for InverseCumulativeRsg< USG, IC >:
+ Collaboration diagram for InverseCumulativeRsg< USG, IC >:

Public Types

typedef Sample< std::vector< Real > > sample_type
 

Public Member Functions

 InverseCumulativeRsg (USG uniformSequenceGenerator)
 
 InverseCumulativeRsg (USG uniformSequenceGenerator, const IC &inverseCumulative)
 
const sample_typenextSequence () const
 returns next sample from the inverse cumulative distribution More...
 
const sample_typelastSequence () const
 
Size dimension () const
 

Private Attributes

USG uniformSequenceGenerator_
 
Size dimension_
 
sample_type x_
 
IC ICD_
 

Detailed Description

template<class USG, class IC>
class QuantLib::InverseCumulativeRsg< USG, IC >

Inverse cumulative random sequence generator.

It uses a sequence of uniform deviate in (0, 1) as the source of cumulative distribution values. Then an inverse cumulative distribution is used to calculate the distribution deviate.

The uniform deviate sequence is supplied by USG.

Class USG must implement the following interface:

USG::sample_type USG::nextSequence() const;
Size USG::dimension() const;
std::size_t Size
size of a container
Definition: types.hpp:58

The inverse cumulative distribution is supplied by IC.

Class IC must implement the following interface:

IC::IC();
Real IC::operator() const;
QL_REAL Real
real number
Definition: types.hpp:50
Examples
DiscreteHedging.cpp.

Definition at line 57 of file inversecumulativersg.hpp.

Member Typedef Documentation

◆ sample_type

typedef Sample<std::vector<Real> > sample_type

Definition at line 59 of file inversecumulativersg.hpp.

Constructor & Destructor Documentation

◆ InverseCumulativeRsg() [1/2]

InverseCumulativeRsg ( USG  uniformSequenceGenerator)
explicit

Definition at line 74 of file inversecumulativersg.hpp.

◆ InverseCumulativeRsg() [2/2]

InverseCumulativeRsg ( USG  uniformSequenceGenerator,
const IC &  inverseCumulative 
)

Definition at line 79 of file inversecumulativersg.hpp.

Member Function Documentation

◆ nextSequence()

const InverseCumulativeRsg< USG, IC >::sample_type & nextSequence

returns next sample from the inverse cumulative distribution

Definition at line 85 of file inversecumulativersg.hpp.

+ Here is the caller graph for this function:

◆ lastSequence()

const sample_type & lastSequence ( ) const

Definition at line 64 of file inversecumulativersg.hpp.

◆ dimension()

Size dimension ( ) const

Definition at line 65 of file inversecumulativersg.hpp.

Member Data Documentation

◆ uniformSequenceGenerator_

USG uniformSequenceGenerator_
private

Definition at line 67 of file inversecumulativersg.hpp.

◆ dimension_

Size dimension_
private

Definition at line 68 of file inversecumulativersg.hpp.

◆ x_

sample_type x_
mutableprivate

Definition at line 69 of file inversecumulativersg.hpp.

◆ ICD_

IC ICD_
private

Definition at line 70 of file inversecumulativersg.hpp.