gaussian_mv#

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

Description

The class object is used in the oneapi::mkl::rng::generate() function to provide n random numbers \(d\)-variate normally distributed, with mean \(a\) and variance-covariance matrix \(C\), where \(a \in R^d;\) \(C\) is dxd symmetric positive matrix.

The probability density function is given by:

\[f_{a, C}(x) = \frac{1}{\sqrt{det(2\pi C)}}exp(-1 / 2(x - a)^T C^{-1}(x-a)).\]

class gaussian_mv#

Syntax

namespace oneapi::mkl::rng {
template<typename RealType = std::int32_t, layout Layout = layout::packed, typename Method = gaussian_mv_method::by_default>
class gaussian_mv {
public:
    using method_type = Method;
    using result_type = RealType;
    explicit gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean, std::vector<RealType> matrix);
    std::int32_t dimen() const;
    std::vector<RealType> mean() const;
    std::vector<RealType> matrix() const;
};
}

Template parameters

typename RealType
Type of the produced values. Supported types:
  • float

  • double

Template parameters

oneapi::mkl::rng::layout Layout
Matrix layout:
  • oneapi::mkl::rng::layout::full

  • oneapi::mkl::rng::layout::packed

  • oneapi::mkl::rng::layout::diagonal

typename Method = oneapi::mkl::rng::gaussian_mv_method::by_default

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

  • oneapi::mkl::rng::gaussian_mv_method::by_default

  • oneapi::mkl::rng::gaussian_mv_method::box_muller

  • oneapi::mkl::rng::gaussian_mv_method::box_muller2

  • oneapi::mkl::rng::gaussian_mv_method::icdf

See description of the methods in Distributions methods template parameter.

Class Members

Routine

Description

explicit gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean, std::vector<RealType> matrix)

Constructor with parameters

std::int32_t dimen() const

Method to obtain number of dimensions in output random vectors

std::vector<double> mean() const

Method to obtain mean vector a of dimension d.

std::vector<double> matrix() const

Method to obtain variance-covariance matrix C

Member types

gaussian_mv::method_type = Method

Description

The type which defines transformation method for generation.

gaussian_mv::result_type = RealType

Description

The type which defines type of generated random numbers.

Constructors

explicit gaussian_mv::gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean, std::vector<RealType> matrix)

Description

Constructor with parameters. dimen is the number of dimensions, mean is a mean vector, matrix is a variance-covariance matrix.

Throws

oneapi::mkl::invalid_argument

Exception is thrown when \(mean.size() \leq 0\), or \(matrix.size() \leq 0\)

Characteristics

std::int32_t gaussian_mv::dimen() const

Return Value

Returns the distribution parameter dimen.

std::vector<double> gaussian_mv::mean() const

Return Value

Returns the mean vector.

std::vector<double> gaussian_mv::matrix() const

Return Value

Returns the variance-covariance matrix.

Parent topic: Distributions