gaussian#
Generates normally distributed random numbers.
Description
The gaussian
class object is used in the generate
and function to provide
random numbers with normal (Gaussian) distribution with mean (a
) and standard deviation
(stddev
, \(\sigma\) ), where \(a, \sigma \in \mathbb{R}; \sigma > 0\)
The probability density function is given by:
The cumulative distribution function is as follows:
The cumulative distribution function \(F_{a, \sigma}(x)\) can be expressed in terms of standard normal distribution \(\phi(x)\) as
class gaussian#
Syntax
namespace oneapi::mkl::rng::device {
template<typename RealType, typename Method>
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
Generation method. The specific values are as follows:
oneapi::mkl::rng::device::gaussian_method::by_default
oneapi::mkl::rng::device::gaussian_method::box_muller2
See description of the methods in Distributions methods template parameter
Class Members
Routine |
Description |
---|---|
Default constructor |
|
Constructor with parameters |
|
Method to obtain left bound a |
|
Method to obtain right bound b |
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 a, RealType b)
Description
Constructor with parameters. mean is a mean value, stddev is a standard deviation value.
Throws
- oneapi::mkl::invalid_argument
Exception is thrown when stddev \(\leq 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: Device Distributions