Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions
gmx::ExponentialDistribution< RealType > Class Template Reference

#include <gromacs/random/exponentialdistribution.h>

Description

template<class RealType = real>
class gmx::ExponentialDistribution< RealType >

Exponential distribution.

The C++ standard library does provide an exponential distribution, but even though they all sample from a correct 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.

Template Parameters
RealTypeFloating-point type, real by default in GROMACS.

Classes

class  param_type
 Exponential distribution parameters. More...
 

Public Types

typedef RealType result_type
 Type of values returned.
 

Public Member Functions

 ExponentialDistribution (result_type lambda=1.0)
 Construct new distribution with given floating-point parameter. More...
 
 ExponentialDistribution (const param_type &param)
 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 exponential distribution with internal parameters. More...
 
template<class Rng >
result_type operator() (Rng &g, const param_type &param)
 Return value from exponential distribution with given parameters. More...
 
result_type lambda () const
 Return the lambda parameter of the exponential distribution.
 
param_type param () const
 Return the full parameter class of exponential distribution.
 
result_type min () const
 Smallest value that can be returned from exponential distribution.
 
result_type max () const
 Largest value that can be returned from exponential distribution.
 
bool operator== (const ExponentialDistribution &x) const
 True if two exponential distributions will produce the same values. More...
 
bool operator!= (const ExponentialDistribution &x) const
 True if two exponential distributions will produce different values. More...
 

Constructor & Destructor Documentation

template<class RealType = real>
gmx::ExponentialDistribution< RealType >::ExponentialDistribution ( result_type  lambda = 1.0)
inlineexplicit

Construct new distribution with given floating-point parameter.

Parameters
lambdalambda/decay parameter
template<class RealType = real>
gmx::ExponentialDistribution< RealType >::ExponentialDistribution ( const param_type param)
inlineexplicit

Construct new distribution from parameter class.

Parameters
paramParameter class as defined inside gmx::ExponentialDistribution.

Member Function Documentation

template<class RealType = real>
bool gmx::ExponentialDistribution< RealType >::operator!= ( const ExponentialDistribution< RealType > &  x) const
inline

True if two exponential distributions will produce different values.

Parameters
xInstance to compare with.
template<class RealType = real>
template<class Rng >
result_type gmx::ExponentialDistribution< RealType >::operator() ( Rng &  g)
inline

Return values from exponential distribution with internal parameters.

Template Parameters
RngRandom engine class
Parameters
gRandom engine
template<class RealType = real>
template<class Rng >
result_type gmx::ExponentialDistribution< RealType >::operator() ( Rng &  g,
const param_type param 
)
inline

Return value from exponential distribution with given parameters.

Template Parameters
RngRandom engine class
Parameters
gRandom engine
paramParameters to use
template<class RealType = real>
bool gmx::ExponentialDistribution< RealType >::operator== ( const ExponentialDistribution< RealType > &  x) const
inline

True if two exponential distributions will produce the same values.

Parameters
xInstance to compare with.

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