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

The normal distribution for MPFR. More...

#include <RandomLib/MPFRNormal.hpp>

Public Member Functions

 MPFRNormal ()
 
 ~MPFRNormal ()
 
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::MPFRNormal< bits >

The normal distribution for MPFR.

This is a transcription of ExactNormal (version 1.3) for use with MPFR.

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

Template Parameters
bitsthe number of bits in each digit.

Definition at line 33 of file MPFRNormal.hpp.

Constructor & Destructor Documentation

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

Initialize the MPFRNormal object.

Definition at line 39 of file MPFRNormal.hpp.

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

Destroy the MPFRNormal object.

Definition at line 43 of file MPFRNormal.hpp.

Member Function Documentation

template<int bits = 32>
void RandomLib::MPFRNormal< 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 51 of file MPFRNormal.hpp.

template<int bits = 32>
int RandomLib::MPFRNormal< 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 62 of file MPFRNormal.hpp.


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