RandomLib  1.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Public Member Functions | List of all members
RandomLib::MPFRNormalK< bits > Class Template Reference

The normal distribution for MPFR (Kahn algorithm). More...

#include <RandomLib/MPFRNormalK.hpp>

Public Member Functions

 MPFRNormalK ()
 
 ~MPFRNormalK ()
 
void operator() (MPFRRandom< bits > &t, gmp_randstate_t r) const
 
int operator() (mpfr_t val, gmp_randstate_t r, mpfr_rnd_t round) const
 

Detailed Description

template<int bits = 32>
class RandomLib::MPFRNormalK< bits >

The normal distribution for MPFR (Kahn algorithm).

This class is DEPRECATED. It is included for illustrative purposes only. The MPFRNormal class provides a somewhat more efficient method for sampling from the normal distribution.

Refs:

N.B. Damien Stehle' drew my attention to this algorithm as a useful way to compute normal deviates exactly.

This class uses mutable private objects. So a single MPFRNormalK object cannot safely be used by multiple threads. In a multi-processing environment, each thread should use a thread-specific MPFRNormalK object.

Template Parameters
bitsthe number of bits in each digit.

Definition at line 43 of file MPFRNormalK.hpp.

Constructor & Destructor Documentation

template<int bits = 32>
RandomLib::MPFRNormalK< bits >::MPFRNormalK ( )
inline

Initialize the MPFRNormalK object.

Definition at line 49 of file MPFRNormalK.hpp.

template<int bits = 32>
RandomLib::MPFRNormalK< bits >::~MPFRNormalK ( )
inline

Destroy the MPFRNormalK object.

Definition at line 54 of file MPFRNormalK.hpp.

Member Function Documentation

template<int bits = 32>
void RandomLib::MPFRNormalK< bits >::operator() ( MPFRRandom< bits > &  t,
gmp_randstate_t  r 
) const
inline

Sample from the normal distribution with mean 0 and variance 1 returning a MPFRRandom.

Parameters
[out]tthe MPFRRandom result.
[in,out]ra GMP random generator.

Definition at line 63 of file MPFRNormalK.hpp.

template<int bits = 32>
int RandomLib::MPFRNormalK< bits >::operator() ( mpfr_t  val,
gmp_randstate_t  r,
mpfr_rnd_t  round 
) const
inline

Sample from the normal distribution with mean 0 and variance 1.

Parameters
[out]valthe sample from the normal distribution
[in,out]ra GMP random generator.
[in]roundthe rounding direction.
Returns
the MPFR ternary result (±1 if val is larger/smaller than the exact sample).

Definition at line 74 of file MPFRNormalK.hpp.


The documentation for this class was generated from the following file: