chi_square#
Class is used for generation of chi-square distributed real types random numbers.
Description
The class object is used in the oneapi::math::rng::generate() function to provide random numbers chi-square distributed with \(n\) degrees of freedom, \(n \in N; n > 0\).
The probability distribution is given by:
The cumulative distribution function is as follows:
class chi_square#
Syntax
namespace oneapi::math::rng {
template<typename RealType = float, typename Method = chi_square_method::by_default>
class chi_square {
public:
using method_type = Method;
using result_type = RealType;
chi_square();
explicit chi_square(std::int32_t n);
std::int32_t n() const;
};
}
Template parameters
- typename RealType
- Type of the produced values. Supported types:
float
double
- typename Method = oneapi::math::rng::chi_square_method::by_default
Transformation method, which will be used for generation. Supported types:
oneapi::math::rng::chi_square_method::by_default
oneapi::math::rng::chi_square_method::gamma_based
See description of the methods in Distributions methods template parameter.
Class Members
Routine |
Description |
---|---|
Default constructor |
|
Constructor with parameters |
|
Method to obtain number of degrees of freedom n |
Member types
chi_square::method_type = Method
Description
The type which defines transformation method for generation.
chi_square::result_type = RealType
Description
The type which defines type of generated random numbers.
Constructors
chi_square::chi_square()
Description
Default constructor for distribution, parameters set as n = 5.
explicit chi_square::chi_square(std::int32_t n)
Description
Constructor with parameters. n is the number of degrees of freedom.
Throws
- oneapi::math::invalid_argument
Exception is thrown when \(n < 1\)
Characteristics
std::int32_t chi_square::n() const
Return Value
Returns the distribution parameter n - number of degrees of freedom.
Parent topic: Host Distributions