OpenMPCD
Public Member Functions | List of all members
OpenMPCD::CUDA::Random::Distributions::Gamma_shape_ge_1< T > Class Template Reference

The gamma distribution, with shape parameter \( k \) assumed to satisfy \( k \ge 1 \). More...

#include <Gamma_shape_ge_1.hpp>

Public Member Functions

OPENMPCD_CUDA_DEVICE Gamma_shape_ge_1 (const T shape, const T scale)
 The constructor. More...
 
template<typename RNG >
OPENMPCD_CUDA_DEVICEoperator() (RNG &rng) const
 Generates a random value sampled from the distribution. More...
 

Detailed Description

template<typename T>
class OpenMPCD::CUDA::Random::Distributions::Gamma_shape_ge_1< T >

The gamma distribution, with shape parameter \( k \) assumed to satisfy \( k \ge 1 \).

This is the distribution which has the probability density function

\[ f \left(x ; k, \theta \right) = \frac { x^{k-1} \exp \left( - \frac{ x }{ \theta } \right) } { \Gamma \left( k \right) \theta^k } \]

where the parameters \( k \ge 1 \) and \( \theta \) are called shape and scale, respectively, and \( \Gamma \) is the gamma function.

For further information, see e.g. [2], chapter IX.3.

Template Parameters
TThe underlying data type, which must be a floating-point type.

Definition at line 54 of file Gamma_shape_ge_1.hpp.

Constructor & Destructor Documentation

◆ Gamma_shape_ge_1()

template<typename T >
OPENMPCD_CUDA_DEVICE OpenMPCD::CUDA::Random::Distributions::Gamma_shape_ge_1< T >::Gamma_shape_ge_1 ( const T  shape,
const T  scale 
)
inline

The constructor.

Exceptions
OpenMPCD::InvalidArgumentErrorIf OPENMPCD_DEBUG is defined, throws if shape < 1 or scale < 0.
Parameters
[in]shapeThe shape parameter \( k \ge 1 \).
[in]scaleThe scale parameter \( \theta > 0 \).

Definition at line 68 of file Gamma_shape_ge_1.hpp.

Member Function Documentation

◆ operator()()

template<typename T >
template<typename RNG >
OPENMPCD_CUDA_DEVICE T OpenMPCD::CUDA::Random::Distributions::Gamma_shape_ge_1< T >::operator() ( RNG rng) const
inline

Generates a random value sampled from the distribution.

This function implements the algorithm in [16], and additionally making use of the scaling property of the gamma distribution, i.e. the fact that if \( X \) is gamma-distributed with shape \( k \) and scale \( \theta \), then \( cX \) is gamma-distributed with shape \( k \) and scale \( c \theta \), given that \( c > 0 \) (see [2], chapter IX.3).

Template Parameters
RNGThe random number generator type.
Parameters
[in]rngThe random number generator instance.

Definition at line 98 of file Gamma_shape_ge_1.hpp.


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