|
PSCF v1.5.0
|
Random number generator on GPU. More...
#include <VecRandom.h>
Public Member Functions | |
| VecRandom () | |
| Constructor. | |
| virtual | ~VecRandom () |
| Destructor. | |
| void | setSeed (unsigned long long seed) |
| Set value of random seed (private member variable seed_). | |
| void | uniform (BackendArray< float, CUT > &data) |
| Populate array with uniform random floats in (0, 1]. | |
| void | uniform (BackendArray< double, CUT > &data) |
| Populate array with uniform random doubles in (0, 1]. | |
| void | uniform (BackendArray< float, CUT > &data, float min, float max) |
| Populate array with uniform random floats in (min, max]. | |
| void | uniform (BackendArray< double, CUT > &data, double min, double max) |
| Populate array with uniform random doubles in (min, max]. | |
| void | normal (BackendArray< float, CUT > &data, float stddev, float mean=0.0) |
| Populate array on device with normal-distributed random floats. | |
| void | normal (BackendArray< double, CUT > &data, double stddev, double mean=0.0) |
| Populate array on device with normal-distributed random doubles. | |
| long | seed () |
| Returns value of random seed (private member variable seed_). | |
Random number generator on GPU.
The generator may be seeded either by reading a long in seed from a file, using the readParam() method, or by using setSeed() method to set the seed. In either case, inputing a positive integer causes that value to be used as a seed, but inputting a value of 0 causes the use of a seed that is generated from the system clock.
Definition at line 47 of file cuda/VecRandom.h.
| Pscf::VecRandom< CUT >::VecRandom | ( | ) |
Constructor.
Definition at line 79 of file VecRandom.cu.
References VecRandom().
Referenced by normal(), normal(), seed(), setSeed(), uniform(), uniform(), uniform(), uniform(), VecRandom(), and ~VecRandom().
|
virtual |
| void Pscf::VecRandom< CUT >::setSeed | ( | unsigned long long | seed | ) |
Set value of random seed (private member variable seed_).
| seed | value of random number generator seed. |
Definition at line 101 of file VecRandom.cu.
References seed(), and VecRandom().
| void Pscf::VecRandom< CUT >::uniform | ( | BackendArray< float, CUT > & | data | ) |
Populate array with uniform random floats in (0, 1].
| data | array to populate |
Definition at line 120 of file VecRandom.cu.
References setSeed(), UTIL_CHECK, and VecRandom().
| void Pscf::VecRandom< CUT >::uniform | ( | BackendArray< double, CUT > & | data | ) |
Populate array with uniform random doubles in (0, 1].
| data | array to populate |
Definition at line 136 of file VecRandom.cu.
References setSeed(), UTIL_CHECK, and VecRandom().
| void Pscf::VecRandom< CUT >::uniform | ( | BackendArray< float, CUT > & | data, |
| float | min, | ||
| float | max ) |
Populate array with uniform random floats in (min, max].
| data | array to populate |
| min | minimum of range |
| max | maximum of range |
Definition at line 152 of file VecRandom.cu.
References uniform(), UTIL_CHECK, and VecRandom().
| void Pscf::VecRandom< CUT >::uniform | ( | BackendArray< double, CUT > & | data, |
| double | min, | ||
| double | max ) |
Populate array with uniform random doubles in (min, max].
| data | array to populate |
| min | minimum of range |
| max | maximum of range |
Definition at line 163 of file VecRandom.cu.
References uniform(), UTIL_CHECK, and VecRandom().
| void Pscf::VecRandom< CUT >::normal | ( | BackendArray< float, CUT > & | data, |
| float | stddev, | ||
| float | mean = 0.0 ) |
Populate array on device with normal-distributed random floats.
| data | array to populate |
| stddev | standard deviation (input) |
| mean | mean value (input, default = 0.0) |
Definition at line 174 of file VecRandom.cu.
References setSeed(), UTIL_CHECK, and VecRandom().
| void Pscf::VecRandom< CUT >::normal | ( | BackendArray< double, CUT > & | data, |
| double | stddev, | ||
| double | mean = 0.0 ) |
Populate array on device with normal-distributed random doubles.
| data | array to populate |
| stddev | standard deviation (input) |
| mean | mean value (input, default = 0.0) |
Definition at line 212 of file VecRandom.cu.
References setSeed(), UTIL_CHECK, and VecRandom().
|
inline |
Returns value of random seed (private member variable seed_).
Definition at line 154 of file cuda/VecRandom.h.
References VecRandom().
Referenced by setSeed().