Generates random numbers from multivariate normal distribution.
template<typename RealType = float, layout Layout = layout::packed, typename Method = mkl::rng::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);
explicit gaussian_mv(const gaussian_mv<RealType, Layout Method>& other);
std::uint32_t dimen() const;
std::vector<RealType> mean() const;
std::vector<RealType> matrix() const;
gaussian_mv<RealType, Layout, Method>& operator=(const gaussian_mv<RealType, Layout, Method>& other);
};
Devices supported: Host and CPU.
The class object is used in the mkl::rng::generate function to provide random numbers with d-variate normal (Gaussian) distribution with mean (a) and variance-covariance matrix C, where a ∈ Rd ; C is dxd symmetric positive-definite matrix.
The probability density function is given by:
where x∈Rd .
Matrix C can be represented as C = TTT, where T is a lower triangular matrix - Cholesky factor of C.
typename RealType = float |
Type of the produced values. The specific values are as follows: float double |
layout Layout = layout::packed |
Type of the matrix storage. The specific values are as follows: layout::packed layout::full layout::diagonal See brief descriptions of the methods in Distributions Template Parameter Method Values |
typename Method = mkl::rng::gaussian_mv_method::by_default |
Generation method. The specific values are as follows: mkl::rng::gaussian_mv_method::box_muller mkl::rng::gaussian_mv_method::box_muller2 mkl::rng::gaussian_mv_method::icdf See brief descriptions of the methods in Distributions Template Parameter Method Values |
Name |
Type |
Description |
---|---|---|
dimen |
std::uint32_t |
Dimension of output random vectors |
mean |
std::vector< RealType> (float, double |
Mean vector a of dimension d. |
matrix |
std::vector< RealType> (float, double |
Variance-covariance matrix C. |