exponential#
Class is used for generation of exponentially distributed real types random numbers.
Description
The class object is used in the oneapi::math::rng::generate() function to provide random numbers exponentially distributed with displacement \(a\) and scalefactor \(\beta\), where \(a, \beta \in R; \beta > 0\).
The probability distribution is given by:
The cumulative distribution function is as follows:
class exponential#
Syntax
namespace oneapi::math::rng {
template<typename RealType = float, typename Method = exponential_method::by_default>
class exponential {
public:
using method_type = Method;
using result_type = RealType;
exponential();
explicit exponential(RealType a, RealType beta);
RealType a() const;
RealType beta() const;
};
}
Template parameters
- typename RealType
- Type of the produced values. Supported types:
float
double
- typename Method = oneapi::math::rng::exponential_method::by_default
Transformation method, which will be used for generation. Supported types:
oneapi::math::rng::exponential_method::by_default
oneapi::math::rng::exponential_method::icdf
oneapi::math::rng::exponential_method::icdf_accurate
See description of the methods in Distributions methods template parameter.
Class Members
Routine |
Description |
---|---|
Default constructor |
|
Constructor with parameters |
|
Method to obtain displacement value |
|
Method to obtain scalefactor |
Member types
exponential::method_type = Method
Description
The type which defines transformation method for generation.
exponential::result_type = RealType
Description
The type which defines type of generated random numbers.
Constructors
exponential::exponential()
Description
Default constructor for distribution, parameters set as a = 0.0, beta = 1.0.
explicit exponential::exponential(RealType a, RealType beta)
Description
Constructor with parameters. a is a displacement, beta is a scalefactor.
Throws
- oneapi::math::invalid_argument
Exception is thrown when \(beta \leq\) static_cast<RealType>(0.0)
Characteristics
RealType exponential::a() const
Return Value
Returns the distribution parameter a - displacement.
RealType exponential::beta() const
Return Value
Returns the distribution parameter beta - scalefactor value.
Parent topic: Host Distributions