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:
class gaussian_mv#
Let SequenceContainerOrView
be a type that can be one of C++ Sequence containers or C++ Views (span
, mdspan
).
It’s implementation defined which type SequenceContainerOrView
represents.
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, SequenceContainerOrView<RealType> mean, SequenceContainerOrView<RealType> matrix);
std::int32_t dimen() const;
SequenceContainerOrView<RealType> mean() const;
SequenceContainerOrView<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 |
---|---|
Constructor with parameters |
|
Method to obtain number of dimensions in output random vectors |
|
Method to obtain mean vector a of dimension d. |
|
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, SequenceContainerOrView<RealType> mean, SequenceContainerOrView<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.
SequenceContainerOrView<double> gaussian_mv::mean() const
Return Value
Returns the mean vector.
SequenceContainerOrView<double> gaussian_mv::matrix() const
Return Value
Returns the variance-covariance matrix.
Parent topic: Host Distributions