gaussian#

Class is used for generation of normally distributed real types random numbers.

Description

The class object is used in the oneapi::mkl::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:

\[f_{a, \sigma}(x) = \frac{1}{\sigma\sqrt{2\pi}}exp(-\frac{(x - a)^2}{2*\sigma^2}), x \in R.\]

The cumulative distribution function is as follows:

\[F_{a, \sigma}(x) = \int^x_{-\infty}\frac{1}{\sigma\sqrt{2\pi}}exp(-\frac{(y - a)^2}{2*\sigma^2})dy, x \in R.\]

class gaussian#

Syntax

namespace oneapi::mkl::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::mkl::rng::gaussian_method::by_default

Transformation method, which will be used for generation. Supported types:

  • oneapi::mkl::rng::gaussian_method::by_default

  • oneapi::mkl::rng::gaussian_method::box_muller

  • oneapi::mkl::rng::gaussian_method::box_muller2

  • oneapi::mkl::rng::gaussian_method::icdf

See description of the methods in Distributions methods template parameter

Class Members

Routine

Description

gaussian()

Default constructor

explicit gaussian(RealType mean, RealType stddev)

Constructor with parameters

RealType mean() const

Method to obtain mean value

RealType stddev() const

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::mkl::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