beta#
Generates beta distributed random numbers.
Description
The beta
class object is used in the generate
function to provide
random numbers with beta distribution that has shape parameters \(p\) and \(q\),
displacement \(\alpha\) and scale parameter \((b, \beta)\), where \(p\), \(q\).
\(\alpha\), \(\beta\) \(\in R; p > 0; q > 0; \beta > 0\).
The probability distribution is given by:
The cumulative distribution function is as follows:
Where \(B(p, 1)\) is the complete beta function.
class beta#
Syntax
namespace oneapi::mkl::rng::device {
template<typename RealType, typename Method>
class beta {
public:
using method_type = Method;
using result_type = RealType;
beta();
explicit beta(RealType p, RealType q, RealType a, RealType b);
RealType p() const;
RealType q() const;
RealType a() const;
RealType b() const;
std::size_t count_rejected_numbers() const;
};
}
Template parameters
- typename RealType
Type of the produced values. Supported types:
float
double
- typename Method
Generation method. The type is unspecified.
Class Members
Routine |
Description |
---|---|
Default constructor |
|
explicit beta(RealType p, RealType q, RealType a, RealType b) |
Constructor with parameters |
Method to obtain shape |
|
Method to obtain shape |
|
Method to obtain displacement \(\alpha\) |
|
Method to obtain scale parameter \(\beta\) |
|
Method to obtain amount of random numbers that were rejected during
the last |
Member types
beta::method_type = Method
Description
The type which defines transformation method for generation.
beta::result_type = RealType
Description
The type which defines type of generated random numbers.
Constructors
beta::beta()
Description
Default constructor for distribution, parameters set as
p
= 1.0, q
= 1.0, \(\alpha\) = 0.0, \(\beta\) = 1.0.
explicit beta::beta(RealType p, RealType q, RealType a, RealType b)
Description
Constructor with parameters. p
and q
are shapes, \(\alpha\) is a displacement, \(\beta\) is a scale parameter.
Throws
- oneapi::mkl::invalid_argument
Exception is thrown when \(p \leq 0\), or \(q \leq 0\), or \(\beta \leq 0\)
Characteristics
RealType beta::p() const
Return Value
Returns the distribution parameter p
- shape.
RealType beta::q() const
Return Value
Returns the distribution parameter q
- shape.
RealType beta::a() const
Return Value
Returns the distribution parameter \(\alpha\) - displacement.
RealType beta::b() const
Return Value
Returns the distribution parameter \(\beta\) - scale parameter value.
std::size_t beta::count_rejected_numbers() const
Return Value
Returns the amount of random numbers that were rejected during
the last generate
function call. If no generate
calls, 0
is returned.
Parent topic: Device Distributions