oneapi::mkl::rng::hypergeometric
¶
Generates hypergeometrically distributed random values.
Syntax
template<typename IntType = std::int32_t, typename Method = hypergeometric_method::by_default> class hypergeometric { public: using method_type = Method; using result_type = IntType; hypergeometric(): hypergeometric(1, 1, 1){} explicit hypergeometric(std::int32_t l, std::int32_T s, std::int32_T m); explicit hypergeometric(const param_type& pt); std::int32_t s() const; std::int32_t m() const; std::int32_t l() const; param_type param() const; void param(const param_type& pt); };
Devices supported: Host and CPU
Include Files
oneapi/mkl/rng.hpp
Description
The
oneapi::mkl::rng::hypergeometric
class object is used in theoneapi::mkl::rng::generate
function to provide hypergeometrically distributed random values with lot sizel
, size of samplings
, and number of marked elements in the lotm
, wherel, m, s∈N∪{0}; l≥ max(s, m)
.Consider a lot of
l
elements comprisingm
“marked” andl
-m
“unmarked” elements. A trial sampling without replacement of exactlys
elements from this lot helps to define the hypergeometric distribution, which is the probability that the group ofs
elements contains exactlyk
marked elements.The probability distribution is given by:)
P(X = k) = \frac{C_m^k C_{l-m}^{s-k}}{C_l^s}
,
k
∈ {max(0,s
+m
-l
), …, min(s
,m
)} The cumulative distribution function is as follows:F_{l, s, m}(x) = \begin{cases} 0, & x < max (0, s + m - l)\\ \sum_{k = \max (0, s+m-l)}^{\lfloor x \rfloor} \frac{C_m^k C_{l-m}^{s-k}}{C_l^s}, & max (0, s + m - l) \leq x \leq \min (s, m)\\ 1, & x > \min(s, m) \end{cases}
Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at https://www.intel.com/PerformanceIndex. Notice revision #20201201
Template Parameters
typename IntType = std::int32_t
Type of the produced values. The specific values are as follows:
std::int32_t
std::uint32_t
typename Method = oneapi::mkl::rng:: hypergeometric_method:: by_default
Generation method. The specific values are as follows:
oneapi::mkl::rng::hypergeometric_method::h2pe
See brief descriptions of the methods in Distributions Template Parameter Method.
Input Parameters
Name
Type
Description
l
std::int32_t
Lot size of
l
.s
std::int32_t
Size of sampling without replacement.
m
std::int32_t
Number of marked elements
m
.