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