Gromacs
2019.3
|
#include <gromacs/random/normaldistribution.h>
Normal distribution.
The C++ standard library does provide a normal distribution, but even though they all sample from the normal distribution different standard library implementations appear to return different sequences of numbers for the same random number generator. To make it easier to use GROMACS unit tests that depend on random numbers we have our own implementation.
Be warned that the normal distribution draws values from the random engine in a loop, so you want to make sure you use a random stream with a very large margin to make sure you do not run out of random numbers in an unlucky case (which will lead to an exception with the GROMACS default random engine).
RealType | Floating-point type, real by default in GROMACS. |
Classes | |
class | param_type |
Normal distribution parameters. More... | |
Public Types | |
typedef RealType | result_type |
Type of values returned. | |
Public Member Functions | |
NormalDistribution (result_type mean=0.0, result_type stddev=1.0) | |
Construct new distribution with given floating-point parameters. More... | |
NormalDistribution (const param_type ¶m) | |
Construct new distribution from parameter class. More... | |
void | reset () |
Flush all internal saved values. | |
template<class Rng > | |
result_type | operator() (Rng &g) |
Return values from normal distribution with internal parameters. More... | |
template<class Rng > | |
result_type | operator() (Rng &g, const param_type ¶m) |
Return value from normal distribution with given parameters. More... | |
result_type | mean () const |
Return the mean of the normal distribution. | |
result_type | stddev () const |
Return the standard deviation of the normal distribution. | |
param_type | param () const |
Return the full parameter class of the normal distribution. | |
result_type | min () const |
Smallest value that can be returned from normal distribution. | |
result_type | max () const |
Largest value that can be returned from normal distribution. | |
bool | operator== (const NormalDistribution &x) const |
True if two normal distributions will produce the same values. More... | |
bool | operator!= (const NormalDistribution &x) const |
True if two normal distributions will produce different values. More... | |
|
inlineexplicit |
Construct new distribution with given floating-point parameters.
mean | Mean of normal distribution |
stddev | Standard deviation of normal distribution |
|
inlineexplicit |
Construct new distribution from parameter class.
param | Parameter class as defined inside gmx::NormalDistribution. |
|
inline |
True if two normal distributions will produce different values.
x | Instance to compare with. |
|
inline |
Return values from normal distribution with internal parameters.
Rng | Random engine class |
g | Random engine |
|
inline |
Return value from normal distribution with given parameters.
Rng | Random engine class |
g | Random engine |
param | Parameters to use |
|
inline |
True if two normal distributions will produce the same values.
x | Instance to compare with. |