negative_binomial¶
Class is used for generation of negative binomially distributed integer types random numbers.
Description
The class object is used in the oneapi::mkl::rng::generate() function to provide random numbers negative binomially distributed with distribution parameters \(a\) and \(p\), where \(p, a \in R; 0 \leq p \leq 1, a > 0\).
The probability distribution is given by:
The cumulative distribution function is as follows:
class negative_binomial¶
Syntax
namespace oneapi::mkl::rng {
template<typename IntType = std::int32_t, typename Method = negative_binomial_method::by_default>
class negative_binomial {
public:
using method_type = Method;
using result_type = IntType;
negative_binomial();
explicit negative_binomial(double a, double p);
double a() const;
double p() const;
};
}
Template parameters
- typename IntType
- Type of the produced values. Supported types:
std::int32_t
std::uint32_t
- typename Method = oneapi::mkl::rng::negative_binomial_method::by_default
Transformation method, which will be used for generation. Supported types:
oneapi::mkl::rng::negative_binomial_method::by_default
oneapi::mkl::rng::negative_binomial_method::nbar
See description of the methods in Distributions methods template parameter.
Class Members
Routine |
Description |
---|---|
Default constructor |
|
Constructor with parameters |
|
Method to obtain the first distribution parameter a |
|
Method to obtain the second distribution parameter p |
Member types
negative_binomial::method_type = Method
Description
The type which defines transformation method for generation.
negative_binomial::result_type = IntType
Description
The type which defines type of generated random numbers.
Constructors
negative_binomial::negative_binomial()
Description
Default constructor for distribution, parameters set as a = 0.1, p = 0.5.
explicit negative_binomial::negative_binomial(double a, double p)
Description
Constructor with parameters. a is the first distribution parameter, p is the second distribution parameter.
Throws
- oneapi::mkl::invalid_argument
Exception is thrown when \(p \ge 1.0\), or \(p \leq 0.0\), or \(a \leq 0.0\)
Characteristics
double negative_binomial::a() const
Return Value
Returns the distribution parameter a - the first distribution parameter.
double negative_binomial::p() const
Return Value
Returns the distribution parameter p - the second distribution parameter.
Parent topic: Distributions