gaussian_mv#
Class is used for generation of multivariate normally distributed real types random numbers.
Description
The class object is used in the oneapi::math::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::math::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::math::rng::layout Layout
- Matrix layout:
oneapi::math::rng::layout::full
oneapi::math::rng::layout::packed
oneapi::math::rng::layout::diagonal
- typename Method = oneapi::math::rng::gaussian_mv_method::by_default
Transformation method, which will be used for generation. Supported types:
oneapi::math::rng::gaussian_mv_method::by_default
oneapi::math::rng::gaussian_mv_method::box_muller
oneapi::math::rng::gaussian_mv_method::box_muller2
oneapi::math::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::math::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