Go to the documentation of this file.
6 #ifndef OPENMPCD_CUDA_RANDOM_DISTRIBUTIONS_GAMMA_HPP
7 #define OPENMPCD_CUDA_RANDOM_DISTRIBUTIONS_GAMMA_HPP
15 #include <boost/static_assert.hpp>
16 #include <boost/type_traits/is_floating_point.hpp>
25 namespace Distributions
67 Gamma(
const T shape,
const T scale)
68 : gamma_shape_ge_1(shape >= 1 ? shape : 1 + shape, scale),
69 inverse_k(shape >= 1 ? 0 : 1 / shape)
71 BOOST_STATIC_ASSERT(boost::is_floating_point<T>::value);
92 template<
typename RNG>
97 return gamma_shape_ge_1(rng);
101 return gamma_shape_ge_1(rng) *
pow(uniform0e1e(rng), inverse_k);
120 #endif //OPENMPCD_CUDA_RANDOM_DISTRIBUTIONS_GAMMA_HPP
OPENMPCD_CUDA_HOST_AND_DEVICE boost::enable_if< boost::is_integral< B >, double >::type pow(const B base, const double exponent)
The power function.
OPENMPCD_CUDA_DEVICE Gamma(const T shape, const T scale)
The constructor.
#define OPENMPCD_CUDA_DEVICE
Denotes a function to be callable from a CUDA Device.
OPENMPCD_CUDA_DEVICE T operator()(RNG &rng) const
Generates a random value sampled from the distribution.
boost::mt11213b RNG
The random number generator type.
#define OPENMPCD_DEBUG_ASSERT_EXCEPTIONTYPE(assertion, ExceptionType)
The gamma distribution, with shape parameter assumed to satisfy .
Invalid argument exception.