lognormal

Contents

lognormal#

Generates lognormally distributed random numbers.

Description

The lognormal class object is used in the generate and function to provide random numbers with average of distribution (m, a) and standard deviation (s, \(\sigma\)) of subject normal distribution, displacement (displ, b), and scalefactor (scale, \(\beta\)), where \(a, \sigma, b, \beta \in \mathbb{R}; \sigma > 0, \beta > 0\).

The probability density function is given by:

\[\begin{split}f_{a, \sigma, b, \beta} (x) = \begin{cases} \frac{1}{\sigma (x - b) \sqrt {2\pi}} \exp \left( -\frac{\ln( \frac{x - b}{\beta}) - a)^2}{2\sigma^2} \right), & x > b \\ 0, & x \leq b \end{cases}\end{split}\]

The cumulative distribution function is as follows:

\[\begin{split}F_{a, \sigma, b, \beta} (x) = \begin{cases} \Phi \left(\frac{\ln( \frac{x - b}{\beta}) - a}{\sigma}\right), & x > b \\ 0, & x \leq b \end{cases}\end{split}\]

class lognormal#

Syntax

namespace oneapi::math::rng::device {
  template<typename RealType, typename Method>
  class lognormal {
  public:
     using method_type = Method;
     using result_type = RealType;

     lognormal();
     explicit lognormal(RealType m, RealType s, RealType displ = (RealType)0.0, RealType scale = (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::math::rng::lognormal_method::by_default

Transformation method, which will be used for generation. Supported types:

  • oneapi::math::rng::device::lognormal_method::by_default

  • oneapi::math::rng::device::lognormal_method::box_muller2

See description of the methods in Distributions methods template parameter.

Class Members

Routine

Description

lognormal()

Default constructor

explicit lognormal(RealType m, RealType s, RealType displ = (RealType)0.0, RealType scale = (RealType)1.0)

Constructor with parameters

RealType m() const

Method to obtain mean value

RealType s() const

Method to obtain standard deviation value

RealType displ() const

Method to obtain displacement value

RealType scale() const

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 = (RealType)0.0, RealType scale = (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::math::invalid_argument

Exception is thrown when \(s \leq 0\), or \(scale \leq 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: Device Distributions