oneapi::mkl::rng::gaussian_mv¶
Generates random numbers from multivariate normal distribution.
Description¶
The class object is used in the oneapi::mkl::rng::generate
function to provide random numbers
with d
-variate normal (Gaussian) distribution with mean (a
) and variance-covariance matrix
C
, where a
∈ R
d ; C
is d x d
symmetric positive-definite matrix.
The probability density function is given by:
where x``∈ ``R
d .
Matrix C
can be represented as C = TTT
, where T
is
a lower triangular matrix - Cholesky factor of C
.
API¶
Syntax¶
template<typename RealType = float, layout Layout = layout::packed,
typename Method = gaussian_mv_method::by_default>
class gaussian_mv {
public:
using method_type = Method;
using result_type = RealType;
static constexpr layout layout_type = Layout;
explicit gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean,
std::vector<RealType> matrix); // deprecated since oneMKL 2023.0
explicit gaussian_mv(std::uint32_t dimen, sycl::span<RealType> mean,
sycl::span<RealType> matrix);
explicit gaussian_mv(const param_type& pt);
std::uint32_t dimen() const;
std::vector<RealType> mean() const;
std::vector<RealType> matrix() const;
param_type param() const;
void param(const param_type& pt);
};
Devices supported: CPU and GPU.
Include Files¶
oneapi/mkl/rng.hpp
Template Parameters¶
Name |
Description |
---|---|
|
Type of the produced values. The specific values are as follows:
|
|
Type of the matrix storage. The specific values are as follows:
See brief descriptions of the methods in Distributions Template Parameter Method. |
|
Generation method. The specific values are as follows:
See brief descriptions of the methods in Distributions Template Parameter Method. |
Input Parameters¶
Name |
Type |
Description |
---|---|---|
dimen |
|
Dimension of output random vectors |
mean |
|
Mean span |
matrix |
|
Variance-covariance matrix |
Note
explicit gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean, std::vector<RealType> matrix);
is deprecated and will be removed in one of the next releases. Useexplicit gaussian_mv(std::uint32_t dimen, sycl::span<RealType> mean, sycl::span<RealType> matrix);
instead.When passing a
sycl::span
that is constructed over a user’s memory to the constructor, users must manage the memory under sycl::span by themselves. They must not destroy the memory while data are processed.