OpenMPCD
|
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_DEVICE T | operator() (RNG &rng) const |
Generates a random value sampled from the distribution. More... | |
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.
T | The underlying data type, which must be a floating-point type. |
Definition at line 54 of file Gamma_shape_ge_1.hpp.
|
inline |
The constructor.
OpenMPCD::InvalidArgumentError | If OPENMPCD_DEBUG is defined, throws if shape < 1 or scale < 0 . |
[in] | shape | The shape parameter \( k \ge 1 \). |
[in] | scale | The scale parameter \( \theta > 0 \). |
Definition at line 68 of file Gamma_shape_ge_1.hpp.
|
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).
RNG | The random number generator type. |
[in] | rng | The random number generator instance. |
Definition at line 98 of file Gamma_shape_ge_1.hpp.