PSCF v1.5.0
Pscf::VecRandom< CPT > Class Reference

Random number generator for arrays of random numbers on CPU. More...

#include <VecRandom.h>

Public Member Functions

 VecRandom ()
 Default constructor.
 VecRandom (Util::Random &random)
 Constructor - creates association with a scalar RNG.
 ~VecRandom ()
 Destructor.
void associate (Util::Random &random)
 Create an association with a Util::Random scalar RNG.
void uniform (Util::Array< double > &data)
 Generate uniform random doubles in (0, 1].
void uniform (Util::Array< double > &data, double min, double max)
 Generate uniform random distribution in range (min, max].
void normal (Util::Array< double > &data, double stddev, double mean=0.0)
 Generate normal-distributed random doubles.

Detailed Description

Random number generator for arrays of random numbers on CPU.

A VecRandom<CPT> generates arrays of random real numbers on a CPU. It uses an associated Util::Random scalar random number generator to generate these random numbers.

Definition at line 43 of file cpp/VecRandom.h.

Constructor & Destructor Documentation

◆ VecRandom() [1/2]

Pscf::VecRandom< CPT >::VecRandom ( )

Default constructor.

Definition at line 13 of file VecRandom.cpp.

References VecRandom().

Referenced by associate(), normal(), uniform(), uniform(), VecRandom(), VecRandom(), and ~VecRandom().

◆ VecRandom() [2/2]

Pscf::VecRandom< CPT >::VecRandom ( Util::Random & random)

Constructor - creates association with a scalar RNG.

Parameters
randomassociated scalar random number generator (RNG)

Definition at line 20 of file VecRandom.cpp.

References VecRandom().

◆ ~VecRandom()

Destructor.

Definition at line 27 of file VecRandom.cpp.

References VecRandom().

Member Function Documentation

◆ associate()

void Pscf::VecRandom< CPT >::associate ( Util::Random & random)

Create an association with a Util::Random scalar RNG.

Parameters
randomassociated scalar random number generator

Definition at line 33 of file VecRandom.cpp.

References VecRandom().

◆ uniform() [1/2]

void Pscf::VecRandom< CPT >::uniform ( Util::Array< double > & data)

Generate uniform random doubles in (0, 1].

Parameters
dataarray to populate

Definition at line 39 of file VecRandom.cpp.

References Util::Array< Data >::capacity(), UTIL_CHECK, and VecRandom().

◆ uniform() [2/2]

void Pscf::VecRandom< CPT >::uniform ( Util::Array< double > & data,
double min,
double max )

Generate uniform random distribution in range (min, max].

Parameters
dataarray to populate with random numbers
minminimum of range
maxmaximum of range

Definition at line 52 of file VecRandom.cpp.

References Util::Array< Data >::capacity(), UTIL_CHECK, and VecRandom().

◆ normal()

void Pscf::VecRandom< CPT >::normal ( Util::Array< double > & data,
double stddev,
double mean = 0.0 )

Generate normal-distributed random doubles.

Parameters
dataarray to populate
stddevstandard deviation (input)
meanmean value (input, default = 0.0)

Definition at line 66 of file VecRandom.cpp.

References Util::Array< Data >::capacity(), UTIL_CHECK, and VecRandom().


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