Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

TRNG Namespace Reference

Tina's random number generators namespace. More...


Compounds

struct  TRNG::vector2d_struct
struct  TRNG::vector3d_struct
struct  TRNG::vector4d_struct
class  TRNG::RNG
class  TRNG::ParkMiller
class  TRNG::LCG32
class  TRNG::LCG64
class  TRNG::MRG2
class  TRNG::MRG3
class  TRNG::MRG4
class  TRNG::CLCG2
class  TRNG::CLCG3
class  TRNG::CLCG4
class  TRNG::EINV
class  TRNG::EINVLCG64
class  TRNG::error

Typedefs

typedef struct vector2d_struct vector2d
 two dimensional vector. More...

typedef struct vector3d_struct vector3d
 three dimensional vector. More...

typedef struct vector4d_struct vector4d
 four dimensional vector. More...


Enumerations

enum  RNG_type {
  RNG_t, generic_MLCG_t, ParkMiller_t, LCG32_t, LCG64_t,
  MRG2_t, MRG3_t, MRG4_t, CLCG2_t, CLCG3_t,
  CLCG4_t, EINV_t, EINVLCG64_t, user1_t, user2_t,
  user3_t
}
 pseudo random number generator types. More...


Functions

template<classRNG_type> void copy (RNG<RNG_type> &R1, RNG<RNG_type> &R2)
 pseudo random number generator copying. More...

const char* version (void)
 TRNG version. More...

long modulo_invers (long, long)
 modulo invers. More...

void gauss (std::vector<long> &, std::vector<long> &, long)
 linear system solver in modular arithmetic. More...

void matrix_mult (const std::vector<long> &, const std::vector<long> &, std::vector<long> &, long)
 matrix multiplication. More...

void matrix_vec_mult (const std::vector<long> &, const std::vector<long> &, std::vector<long> &, long)
 matrix vector multiplication. More...

double Gamma (double)
  -function. More...

double ln_Gamma (double)
  of -function. More...

double Gamma_P (double, double)
 incomplete -function. More...

double Gamma_Q (double, double)
 incomplete -function. More...

double incomp_Gamma (double, double)
 incomplete -function. More...

double comp_incomp_Gamma (double, double)
 incomplete -function. More...

double Gamma_ser (double, double)
 incomplete -function. More...

double Gamma_cf (double, double)
 incomplete -function. More...

double ln_factorial (long)
 logarithm of the factorial function. More...

long binomial_coeff (long, long)
 binomial coefficient. More...

double errf (double)
 error function. More...

double chi_square_test (const std::vector<double> &, const std::vector<double> &)
 Chisquare test. More...

double chi_square_prob (double, long)
 chisquare test. More...

double Stirling_num2 (long, long)
 Stirling number. More...

double Student_t (double, long, bool=true)
 values for Student's -distribution. More...

long find_interval (const std::vector<double> &, const double)
 find interval. More...

double uniform_pdf (double)
 probalility density. More...

double uniform_pdf (double, double, double)
 probalility density. More...

double uniformco_pdf (double)
 probalility density. More...

double uniformco_pdf (double, double, double)
 probalility density. More...

double uniformcc_pdf (double)
 probalility density. More...

double uniformcc_pdf (double, double, double)
 probalility density. More...

double uniformoc_pdf (double)
 probalility density. More...

double uniformoc_pdf (double, double, double)
 probalility density. More...

double uniformoo_pdf (double)
 probalility density. More...

double uniformoo_pdf (double, double, double)
 probalility density. More...

double normal_dist_pdf (double, double, double)
 probalility density. More...

double exp_dist_pdf (double, double)
 probalility density. More...

double laplace_dist_pdf (double, double)
 probalility density. More...

double tent_dist_pdf (double, double)
 probalility density. More...

double Gamma_dist_pdf (double, double, double)
 probalility density. More...

double Beta_dist_pdf (double, double, double)
 probalility density. More...

double chi_square_dist_pdf (double, double)
 probalility density. More...

double Student_t_dist_pdf (double, double)
 probalility density. More...

double binomial_dist_pdf (long, long, double)
 probalility density. More...

double poisson_dist_pdf (long, double)
 probalility density. More...

double geometric_dist_pdf (long, double)
 probalility density. More...


Detailed Description

Tina's random number generators namespace.

All function and classes are encapsulated by the namespace TRNG.


Typedef Documentation

typedef struct vector2d_struct TRNG::vector2d
 

This structure is for storing two dimensional vectors. The method TRNG::RNG::spherical2d(void) returns this structure.

Definition at line 76 of file trng.h.

typedef struct vector3d_struct TRNG::vector3d
 

This structure is for storing three dimensional vectors. The method TRNG::RNG::spherical3d(void) returns this structure.

Definition at line 93 of file trng.h.

typedef struct vector4d_struct TRNG::vector4d
 

This structure is for storing four dimensional vectors. The method TRNG::RNG::spherical4d(void) returns this structure.

Definition at line 112 of file trng.h.


Enumeration Type Documentation

enum TRNG::RNG_type
 

Every pseudo random number generator's type can be identified by a class member type which has anny value from this enumeration type.

Enumeration values:
RNG_t   not specialized random number generator.
generic_MLCG_t   generic multiplicative linear congruential random number generator.
ParkMiller_t   random number generator class ParkMiller.
LCG32_t   random number generator class LCG32.
LCG64_t   random number generator class LCG64.
MRG2_t   random number generator class MRG2.
MRG3_t   random number generator class MRG3.
MRG4_t   random number generator class MRG4.
CLCG2_t   random number generator class CLCG2.
CLCG3_t   random number generator class CLCG3.
CLCG4_t   random number generator class CLCG4.
EINV_t   random number generator class EINV.
EINVLCG64_t   random number generator class EINVLCG64.
user1_t   user defined random number generator class nr 1.
user2_t   user defined random number generator class nr 2.
user3_t   user defined random number generator class nr 3.

Definition at line 44 of file trng.h.


Function Documentation

template<classRNG_type>
void TRNG::copy ( RNG< RNG_type >& R1,
RNG< RNG_type >& R2 )
 

Copies a pseudo random number generator's status to another.

Parameters:
R1   reference to generator to copy
R2   other pseudo random number generator
Author(s):
Heiko Bauke

Definition at line 1586 of file trng.h.

const char * TRNG::version ( void )
 

This function returns a pointer to a zero termiated string with the TRNG version.

Returns:
pointer to a zero termiated string

Definition at line 30 of file trnglib.cc.

long TRNG::modulo_invers ( long a,
long m )
 

Solves the equation .

Returns:
the inverse of .
Parameters:
a   a positive integer.
m   a prime modulus.
Exceptions:
error   if or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 46 of file trnglib.cc.

Referenced by gauss().

void TRNG::gauss ( std::vector< long >& a,
std::vector< long >& b,
long m )
 

Solves a system of linear equations

in modular arithmetic using Gauß elimination.

Parameters:
a   reference to the coefficient matrix, content is destroyed after function call
b   reference to the inhomogenous right side, contains the solution after function call
m   prime modulus
Exceptions:
error   if coefficient matrix is singular or the matrices have invalid sizes
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 96 of file trnglib.cc.

void TRNG::matrix_mult ( const std::vector< long >& a,
const std::vector< long >& b,
std::vector< long >& c,
long m )
 

Multiply two equal sized quadratic matrices and in modular arithmetic, .

Parameters:
a   reference to matrix
b   reference to matrix
c   reference to matrix
m   modulus
Exceptions:
error   if the matrices are different sized
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 179 of file trnglib.cc.

void TRNG::matrix_vec_mult ( const std::vector< long >& a,
const std::vector< long >& b,
std::vector< long >& c,
long m )
 

Multiply a quadratic matrix and $a$ vector in modular arithmetic, .

Parameters:
a   reference to matrix
b   reference to vector
c   reference to vector
m   modulus
Exceptions:
error   if the matrices are different sized
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 212 of file trnglib.cc.

double TRNG::Gamma ( double x )
 

Computes the -function for positive arguments.

Parameters:
x   argument
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 285 of file trnglib.cc.

double TRNG::ln_Gamma ( double x )
 

Computes the -function's logarithm for positive arguments.

Parameters:
x   argument
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 248 of file trnglib.cc.

double TRNG::Gamma_P ( double a,
double x )
 

Computes the incomplete -function for positive arguments.

Parameters:
a   argument
x   argument
Exceptions:
error   if or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 347 of file trnglib.cc.

double TRNG::Gamma_Q ( double a,
double x )
 

Computes the incomplete -function for positive arguments.

Parameters:
a   argument
x   argument
Exceptions:
error   if or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 371 of file trnglib.cc.

double TRNG::incomp_Gamma ( double a,
double x )
 

Computes the incomplete -function for positive arguments.

Parameters:
a   argument
x   argument
Exceptions:
error   if or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 395 of file trnglib.cc.

double TRNG::comp_incomp_Gamma ( double a,
double x )
 

Computes the complementary incomplete -function for positive arguments.

Parameters:
a   argument
x   argument
Exceptions:
error   if or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 417 of file trnglib.cc.

double TRNG::Gamma_ser ( double a,
double x )
 

Computes incomplete Gamma function's ( ) power series representation for .

Parameters:
a   argument
x   argument
Exceptions:
error   if or or at convergence problems
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 438 of file trnglib.cc.

double TRNG::Gamma_cf ( double a,
double x )
 

Computes incomplete Gamma function's ( ) continued fraction representation for .

Parameters:
a   argument
x   argument
Exceptions:
error   if or or at convergence problems
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 476 of file trnglib.cc.

double TRNG::ln_factorial ( long n )
 

Returns:
Parameters:
n  
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 523 of file trnglib.cc.

long TRNG::binomial_coeff ( long n,
long k )
 

Returns:
binomial coefficient or or is returned
Parameters:
n  
k  
Author(s):
Heiko Bauke

Definition at line 549 of file trnglib.cc.

double TRNG::errf ( double x )
 

Computes the error function

Returns:
Author(s):
Heiko Bauke

Definition at line 569 of file trnglib.cc.

double TRNG::chi_square_test ( const std::vector< double >& prob,
const std::vector< double >& observ )
 

Applies a -test.

Returns:
-value
Parameters:
prob   reference to a vector with some probabilities
observ   reference to a vector with numbers of actual observations
Exceptions:
error   if arguments are not equal sized or number of observations is less then five
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 588 of file trnglib.cc.

double TRNG::chi_square_prob ( double chi2,
long df )
 

Computes the probability corresponding to a -value.

Parameters:
chi2   -value
df   degrees of freedom
Exceptions:
error   if degrees of freedom less than one
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 620 of file trnglib.cc.

double TRNG::Stirling_num2 ( long n,
long m )
 

Computes the Stirling number of the 2nd kind .

Returns:
Stirling number of the 2nd kind
Parameters:
n   1st parameter
m   2nd parameter
Author(s):
Heiko Bauke

Definition at line 645 of file trnglib.cc.

double TRNG::Student_t ( double p,
long nu,
bool symmetric = true )
 

Computes of the -distribution. is defined in the symmetric case as

and in the asymmetric case as

Parameters:
p   probability
nu   degrees of freedom
symmetric   is true for the symmetric case
Exceptions:
error   if less than one degree of freedom or probability out of range
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 685 of file trnglib.cc.

long TRNG::find_interval ( const std::vector< double >& borders,
const x )
 

This function searches for the interval which contains using an algorithm. The intervals are

if is a sorted vector with elements with .

Returns:
interval number
Parameters:
borders   reference to a sorted vector with interval edges
x   value that determs the interval
Author(s):
Heiko Bauke

Definition at line 756 of file trnglib.cc.

double TRNG::uniform_pdf ( double x )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 784 of file trnglib.cc.

double TRNG::uniform_pdf ( double x,
double a,
double b )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 795 of file trnglib.cc.

double TRNG::uniformco_pdf ( double x )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 808 of file trnglib.cc.

Referenced by uniform_pdf().

double TRNG::uniformco_pdf ( double x,
double a,
double b )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 822 of file trnglib.cc.

double TRNG::uniformcc_pdf ( double x )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 838 of file trnglib.cc.

double TRNG::uniformcc_pdf ( double x,
double a,
double b )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 853 of file trnglib.cc.

double TRNG::uniformoc_pdf ( double x )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 869 of file trnglib.cc.

double TRNG::uniformoc_pdf ( double x,
double a,
double b )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 883 of file trnglib.cc.

double TRNG::uniformoo_pdf ( double x )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
if else
Author(s):
Heiko Bauke

Definition at line 899 of file trnglib.cc.

double TRNG::uniformoo_pdf ( double x,
double a,
double b )
 

Calculates the probalility density function for in equidistributed random variate.

Returns:
Author(s):
Heiko Bauke

Definition at line 913 of file trnglib.cc.

double TRNG::normal_dist_pdf ( double x,
double sigma = 1.0,
double mu = 0.0 )
 

This function calculates the probalility density for a random variate with normal distribution. This distribution is defined as

with mean .

Returns:
Parameters:
x  
sigma   variance
mu   mean
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 938 of file trnglib.cc.

double TRNG::exp_dist_pdf ( double x,
double mu = 1.0 )
 

This function calculates the probalility density for a random variate with exponential distribution. This distribution is defined as

with .

Returns:
Parameters:
x  
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 965 of file trnglib.cc.

double TRNG::laplace_dist_pdf ( double x,
double a = 1.0 )
 

This function calculates the probalility density for a random variate with Laplace distribution. This distribution is defined as

with .

Returns:
Parameters:
x  
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 990 of file trnglib.cc.

double TRNG::tent_dist_pdf ( double x,
double a = 1.0 )
 

The tent shaped probability distribution is defined as

with .

Returns:
Parameters:
x  
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 1016 of file trnglib.cc.

double TRNG::Gamma_dist_pdf ( double x,
double a,
double b )
 

This function calculates the probalility density for a random variate with -distribution. This distribution is defined as

Returns:
Parameters:
x  
a   parameter ,
b   parameter ,
Exceptions:
error   if or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 1047 of file trnglib.cc.

double TRNG::Beta_dist_pdf ( double x,
double a,
double b )
 

This function calculates the probalility density for a random variate with B-distribution. This distribution is defined as

Returns:
Parameters:
x  
a   parameter ,
b   parameter ,
Exceptions:
error   if or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 1084 of file trnglib.cc.

double TRNG::chi_square_dist_pdf ( double x,
double nu )
 

This function calculates the probalility density for a random variate with -distribution. This distribution is defined as

Returns:
Parameters:
x  
nu   parameter ,
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 1116 of file trnglib.cc.

double TRNG::Student_t_dist_pdf ( double x,
double nu )
 

This function calculates the probalility density for a random variate with Student's distribution. This distribution is defined as

Returns:
Parameters:
x  
nu   parameter ,
Exceptions:
error   if
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 1143 of file trnglib.cc.

double TRNG::binomial_dist_pdf ( long k,
long n,
double p = 0.5 )
 

This function calculates the probalility density for a random variate with binomial distribution. This distribution is defined as

Returns:
Parameters:
n   number of trails
p   probability in each trail
Exceptions:
error   if or or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 1168 of file trnglib.cc.

double TRNG::poisson_dist_pdf ( long k,
double mu )
 

This function calculates the probalility density for a random variate with poisson distribution. This distribution is defined as

with mean .

Returns:
Parameters:
n   number of trails
p   probability in each trail
Exceptions:
error   if or or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 1201 of file trnglib.cc.

double TRNG::geometric_dist_pdf ( long k,
double q )
 

This function calculates the probalility density for a random variate with geometric distribution. This distribution is defined as

Returns:
Parameters:
q   probability
Exceptions:
error   if or or
See also:
TRNG::error
Author(s):
Heiko Bauke

Definition at line 1223 of file trnglib.cc.


Generated at Tue Apr 30 12:03:23 2002 for Tina's Random Number Generators by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000