QDP++
QDP::RNG Namespace Reference

Random number generator namespace. More...

Functions

int numbits (int x)
 Find the number of bits required to represent x.
void initDefaultRNG ()
 Initialize the random number generator with a default seed.
void initRNG ()
 Initialize the internals of the random number generator.
void finalizeRNG ()
void setrn (const Seed &seed)
 Initialize the random number generator seed.
void savern (Seed &seed)
 Return a copy of the random number seed.
float sranf (Seed &seed, Seed &skewed_seed, const Seed &seed_mult)
 Scalar random number generator. Done on the front end. *‍/.
void sranf (float *d, int N, Seed &seed, ILatticeSeed &skewed_seed, const Seed &seed_mult)
 Scalar random number generator. Done on the front end. *‍/.

Variables

Seed ran_seed
 Global (current) seed.
Seed ran_mult
 RNG multiplier.
Seed ran_mult_n
 RNG multiplier raised to the volume+1.
LatticeSeedlattice_ran_mult
 The lattice of skewed RNG multipliers.

Detailed Description

Random number generator namespace.

A collection of routines and data for supporting random numbers

It is a linear congruential with modulus m = 2**47, increment c = 0, and multiplier a = (2**36)*m3 + (2**24)*m2 + (2**12)*m1 + m0.

Function Documentation

◆ finalizeRNG()

void QDP::RNG::finalizeRNG ( )

Definition at line 169 of file qdp_random.cc.

References lattice_ran_mult.

Referenced by QDP::Layout::destroy().

◆ initDefaultRNG()

void QDP::RNG::initDefaultRNG ( void )

Initialize the random number generator with a default seed.

Default initialization of the RNG.

Uses arbitrary internal seed to initialize the RNG

Definition at line 44 of file qdp_random.cc.

References initRNG(), and setrn().

Referenced by QDP::Layout::initDefaults().

◆ initRNG()

void QDP::RNG::initRNG ( )

Initialize the internals of the random number generator.

Initialize the internals of the RNG.

Definition at line 54 of file qdp_random.cc.

References QDP::copymask(), QDP::QDPIO::cout, lattice_ran_mult, QDP::Layout::latticeCoordinate(), QDP::Layout::lattSize(), QDP::Nd, numbits(), QDP::QDP_error_exit(), ran_mult, ran_mult_n, QDP::setProfileLevel(), and QDP::Layout::vol().

Referenced by initDefaultRNG().

◆ numbits()

int QDP::RNG::numbits ( int x)

Find the number of bits required to represent x.

Definition at line 29 of file qdp_random.cc.

Referenced by initRNG().

◆ savern()

void QDP::RNG::savern ( Seed & lseed)

Return a copy of the random number seed.

Recover the current RNG seed.

Seeds are big-ints

Definition at line 184 of file qdp_random.cc.

References ran_seed.

◆ setrn()

void QDP::RNG::setrn ( const Seed & lseed)

Initialize the random number generator seed.

Initialize the RNG seed.

Seeds are big-ints

Definition at line 177 of file qdp_random.cc.

References ran_seed.

Referenced by initDefaultRNG().

◆ sranf() [1/2]

void QDP::RNG::sranf ( float * d,
int N,
Seed & seed,
ILatticeSeed & skewed_seed,
const Seed & seed_mult )

Scalar random number generator. Done on the front end. *‍/.

Internal seed multiplier.

It is linear congruential with modulus m = 2**47, increment c = 0, and multiplier a = (2**36)*m3 + (2**24)*m2 + (2**12)*m1 + m0.

Definition at line 243 of file qdp_random.cc.

References QDP::cast_rep(), QDP::getSite(), and QDP::seedToFloat().

◆ sranf() [2/2]

float QDP::RNG::sranf ( Seed & seed,
Seed & skewed_seed,
const Seed & seed_mult )

Scalar random number generator. Done on the front end. *‍/.

Internal seed multiplier.

It is linear congruential with modulus m = 2**47, increment c = 0, and multiplier a = (2**36)*m3 + (2**24)*m2 + (2**12)*m1 + m0.

Definition at line 195 of file qdp_random.cc.

References QDP::cast_rep(), and QDP::seedToFloat().

Referenced by QDP::fill_random(), QDP::fill_random(), QDP::fill_random(), and QDP::fill_random().

Variable Documentation

◆ lattice_ran_mult

LatticeSeed * QDP::RNG::lattice_ran_mult

The lattice of skewed RNG multipliers.

Definition at line 26 of file qdp_random.cc.

Referenced by finalizeRNG(), initRNG(), and QDP::random().

◆ ran_mult

Seed QDP::RNG::ran_mult

RNG multiplier.

Definition at line 22 of file qdp_random.cc.

Referenced by initRNG(), and QDP::random().

◆ ran_mult_n

Seed QDP::RNG::ran_mult_n

RNG multiplier raised to the volume+1.

Definition at line 24 of file qdp_random.cc.

Referenced by initRNG(), and QDP::random().

◆ ran_seed

Seed QDP::RNG::ran_seed

Global (current) seed.

Definition at line 20 of file qdp_random.cc.

Referenced by QDP::random(), QDP::random(), savern(), and setrn().