A Discrete-Event Network Simulator
API
anonymous_namespace{rng-stream.cc} Namespace Reference

Unnamed namespace for MRG32k3a implementation details. More...

Classes

struct  Precalculated
 The transition matrices of the two MRG components (in matrix form), raised to all powers of 2 from 1 to 191. More...
 

Typedefs

typedef double Matrix[3][3]
 Type for 3x3 matrix of doubles. More...
 

Functions

void MatMatModM (const Matrix A, const Matrix B, Matrix C, double m)
 Compute the matrix C = A*B MOD m. More...
 
void MatTwoPowModM (const Matrix src, Matrix dst, double m, int32_t e)
 Compute the matrix B = (A^(2^e) Mod m); works also if A = B. More...
 
void MatVecModM (const Matrix A, const double s[3], double v[3], double m)
 Compute the vector v = A*s MOD m. More...
 
double MultModM (double a, double s, double c, double m)
 Return (a*s + c) MOD m; a, s, c and m must be < 2^35. More...
 
struct Precalculated PowerOfTwoConstants (void)
 Compute the transition matrices of the two MRG components. More...
 
void PowerOfTwoMatrix (int n, Matrix a1p, Matrix a2p)
 Get the transition matrices raised to a power of 2. More...
 

Variables

const double a12 = 1403580.0
 First component multiplier of n - 2 value. More...
 
const double a13n = 810728.0
 First component multiplier of n - 3 value. More...
 
const Matrix A1p0
 First component transition matrix. More...
 
const double a21 = 527612.0
 Second component multiplier of n - 1 value. More...
 
const double a23n = 1370589.0
 Second component multiplier of n - 3 value. More...
 
const Matrix A2p0
 Second component transition matrix. More...
 
const double m1 = 4294967087.0
 First component modulus, 232 - 209. More...
 
const double m2 = 4294944443.0
 Second component modulus, 232 - 22853. More...
 
const double norm = 1.0 / (m1 + 1.0)
 Normalization to obtain randoms on [0,1). More...
 
const double two17 = 131072.0
 Decomposition factor for computing a*s in less than 53 bits, 217 More...
 
const double two53 = 9007199254740992.0
 IEEE-754 floating point precision, 253 More...
 

Detailed Description

Unnamed namespace for MRG32k3a implementation details.

Function Documentation

struct Precalculated anonymous_namespace{rng-stream.cc}::PowerOfTwoConstants ( void  )

Compute the transition matrices of the two MRG components.

Returns
The precalculated powers of the transition matrices.

Definition at line 301 of file rng-stream.cc.

References anonymous_namespace{rng-stream.cc}::Precalculated::a1, anonymous_namespace{rng-stream.cc}::Precalculated::a2, and MatTwoPowModM().

Referenced by PowerOfTwoMatrix().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{rng-stream.cc}::PowerOfTwoMatrix ( int  n,
Matrix  a1p,
Matrix  a2p 
)

Get the transition matrices raised to a power of 2.

Parameters
[in]nThe power of 2.
[out]a1pThe first transition matrix power.
[out]a2pThe second transition matrix power.

Definition at line 318 of file rng-stream.cc.

References anonymous_namespace{rng-stream.cc}::Precalculated::a1, anonymous_namespace{rng-stream.cc}::Precalculated::a2, and PowerOfTwoConstants().

Referenced by ns3::RngStream::AdvanceNthBy().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: