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
RandomizedLDS< LDS, PRS > Class Template Reference

Randomized (random shift) low-discrepancy sequence. More...

#include <randomizedlds.hpp>

+ Collaboration diagram for RandomizedLDS< LDS, PRS >:

Public Types

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

Public Member Functions

 RandomizedLDS (const LDS &ldsg, PRS prsg)
 
 RandomizedLDS (const LDS &ldsg)
 
 RandomizedLDS (Size dimensionality, BigNatural ldsSeed=0, BigNatural prsSeed=0)
 
const sample_typenextSequence () const
 returns next sample using a given randomizing vector More...
 
const sample_typelastSequence () const
 
void nextRandomizer ()
 
Size dimension () const
 

Private Attributes

LDS ldsg_
 
LDS pristineldsg_
 
PRS prsg_
 
Size dimension_
 
sample_type x
 
sample_type randomizer_
 

Detailed Description

template<class LDS, class PRS = RandomSequenceGenerator<MersenneTwisterUniformRng>>
class QuantLib::RandomizedLDS< LDS, PRS >

Randomized (random shift) low-discrepancy sequence.

Random-shifts a uniform low-discrepancy sequence of dimension \( N \) by adding (modulo 1 for each coordinate) a pseudo-random uniform deviate in \( (0, 1)^N. \) It is used for implementing Randomized Quasi Monte Carlo.

The uniform low discrepancy sequence is supplied by LDS; the uniform pseudo-random sequence is supplied by PRS.

Both class LDS and PRS must implement the following interface:

LDS::sample_type LDS::nextSequence() const;
Size LDS::dimension() const;
std::size_t Size
size of a container
Definition: types.hpp:58
Precondition
LDS and PRS must have the same dimension \( N \)
Warning:
Inverting LDS and PRS is possible, but it doesn't make sense.
Tests:
correct initialization is tested.

Definition at line 59 of file randomizedlds.hpp.

Member Typedef Documentation

◆ sample_type

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

Definition at line 61 of file randomizedlds.hpp.

Constructor & Destructor Documentation

◆ RandomizedLDS() [1/3]

RandomizedLDS ( const LDS &  ldsg,
PRS  prsg 
)

Definition at line 87 of file randomizedlds.hpp.

◆ RandomizedLDS() [2/3]

RandomizedLDS ( const LDS &  ldsg)

Definition at line 100 of file randomizedlds.hpp.

◆ RandomizedLDS() [3/3]

RandomizedLDS ( Size  dimensionality,
BigNatural  ldsSeed = 0,
BigNatural  prsSeed = 0 
)

Definition at line 110 of file randomizedlds.hpp.

Member Function Documentation

◆ nextSequence()

const RandomizedLDS< LDS, PRS >::sample_type & nextSequence

returns next sample using a given randomizing vector

Definition at line 122 of file randomizedlds.hpp.

◆ lastSequence()

const sample_type & lastSequence ( ) const

Definition at line 69 of file randomizedlds.hpp.

◆ nextRandomizer()

void nextRandomizer ( )

update the randomizing vector and re-initialize the low discrepancy generator

Definition at line 74 of file randomizedlds.hpp.

◆ dimension()

Size dimension ( ) const

Definition at line 78 of file randomizedlds.hpp.

Member Data Documentation

◆ ldsg_

LDS ldsg_
mutableprivate

Definition at line 80 of file randomizedlds.hpp.

◆ pristineldsg_

LDS pristineldsg_
private

Definition at line 80 of file randomizedlds.hpp.

◆ prsg_

PRS prsg_
private

Definition at line 81 of file randomizedlds.hpp.

◆ dimension_

Size dimension_
private

Definition at line 82 of file randomizedlds.hpp.

◆ x

sample_type x
mutableprivate

Definition at line 83 of file randomizedlds.hpp.

◆ randomizer_

sample_type randomizer_
private

Definition at line 83 of file randomizedlds.hpp.