QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
PolarStudentTRng< URNG > Class Template Reference

Student t random number generator. More...

#include <ql/experimental/math/polarstudenttrng.hpp>

+ Collaboration diagram for PolarStudentTRng< URNG >:

Public Types

typedef Sample< Realsample_type
 
typedef URNG urng_type
 

Public Member Functions

 PolarStudentTRng (Real degFreedom, BigNatural seed=0)
 
 PolarStudentTRng (Real degFreedom, const URNG &urng)
 
sample_type next () const
 returns a sample from a Student-t distribution More...
 

Private Attributes

URNG uniformGenerator_
 
Real degFreedom_
 

Detailed Description

template<class URNG>
class QuantLib::PolarStudentTRng< URNG >

Student t random number generator.

Polar transformation based Student T random number generator. See "Polar Generation of Random Variates With the t-Distribution", Ralph W. Bailey, April 1994, in Mathematics of Computation, Vol 62-206 page 779. The one implemented here is a variant of this algorithm from "Random Number Generation and Monte Carlo Methods", Springer, 2003, page 185. Using a uniform RNG on a [-1,1] support, the extra call to the uniform generator (used for the sign of the sample) is avoided.

Class RNG must implement the following interface:

URNG::sample_type RNG::next() const;
Warning:
do not use with a low-discrepancy sequence generator.
Examples
BasketLosses.cpp.

Definition at line 50 of file polarstudenttrng.hpp.

Member Typedef Documentation

◆ sample_type

Definition at line 52 of file polarstudenttrng.hpp.

◆ urng_type

typedef URNG urng_type

Definition at line 53 of file polarstudenttrng.hpp.

Constructor & Destructor Documentation

◆ PolarStudentTRng() [1/2]

PolarStudentTRng ( Real  degFreedom,
BigNatural  seed = 0 
)
explicit

Definition at line 55 of file polarstudenttrng.hpp.

◆ PolarStudentTRng() [2/2]

PolarStudentTRng ( Real  degFreedom,
const URNG &  urng 
)
explicit

Definition at line 62 of file polarstudenttrng.hpp.

Member Function Documentation

◆ next()

returns a sample from a Student-t distribution

Definition at line 78 of file polarstudenttrng.hpp.

Member Data Documentation

◆ uniformGenerator_

URNG uniformGenerator_
private

Definition at line 72 of file polarstudenttrng.hpp.

◆ degFreedom_

Real degFreedom_
mutableprivate

Definition at line 73 of file polarstudenttrng.hpp.