lognormal#
Class is used for generation of lognormally distributed real types random numbers.
Description
The class object is used in the oneapi::mkl::rng::generate() function to provide random numbers lognormally distributed with mean \((m, a)\) and standard deviation \((s, \sigma)\) of subject normal distribution, displacement \((displ, b)\), and scalefactor \((scale, \beta)\), where \(a, \sigma, b, \beta \in R; \sigma > 0; \beta > 0\).
The probability distribution is given by:
The cumulative distribution function is as follows:
class lognormal#
Syntax
namespace oneapi::mkl::rng {
template<typename RealType = float, typename Method = lognormal_method::by_default>
class lognormal {
public:
using method_type = Method;
using result_type = RealType;
lognormal();
explicit lognormal(RealType m, RealType s, RealType displ = static_cast<RealType>(0.0), RealType scale = static_cast<RealType>(1.0));
RealType m() const;
RealType s() const;
RealType displ() const;
RealType scale() const;
};
}
Template parameters
- typename RealType
- Type of the produced values. Supported types:
float
double
- typename Method = oneapi::mkl::rng::lognormal_method::by_default
Transformation method, which will be used for generation. Supported types:
oneapi::mkl::rng::lognormal_method::by_default
oneapi::mkl::rng::lognormal_method::box_muller2
oneapi::mkl::rng::lognormal_method::icdf
oneapi::mkl::rng::lognormal_method::box_muller2_accurate
oneapi::mkl::rng::lognormal_method::icdf_accurate
See description of the methods in Distributions methods template parameter.
Class Members
Routine |
Description |
---|---|
Default constructor |
|
Constructor with parameters |
|
Method to obtain mean value |
|
Method to obtain standard deviation value |
|
Method to obtain displacement value |
|
Method to obtain scalefactor value |
Member types
lognormal::method_type = Method
Description
The type which defines transformation method for generation.
lognormal::result_type = RealType
Description
The type which defines type of generated random numbers.
Constructors
lognormal::lognormal()
Description
Default constructor for distribution, parameters set as m = 0.0, s = 1.0, displ = 0.0, scale = 1.0.
explicit lognormal::lognormal(RealType m, RealType s, RealType displ = static_cast<RealType>(0.0), RealType scale = static_cast<RealType>(1.0))
Description
Constructor with parameters. m is a mean value, s is a standard deviation value, displ is a displacement value, scale is a scalefactor value.
Throws
- oneapi::mkl::invalid_argument
Exception is thrown when \(s \leq\) static_cast<RealType>(0.0), or \(scale \leq\) static_cast<RealType>(0.0)
Characteristics
RealType lognormal::m() const
Return Value
Returns the distribution parameter m - mean value.
RealType lognormal::s() const
Return Value
Returns the distribution parameter s - standard deviation value.
RealType lognormal::displ() const
Return Value
Returns the distribution parameter displ - displacement value.
RealType lognormal::scale() const
Return Value
Returns the distribution parameter scale - scalefactor value.
Parent topic: Distributions