exponential#

Generates exponentially distributed random numbers.

Description

The exponential class object is used in the generate function to provide random numbers with exponential distribution that has displacement \(a\) and scalefactor \(\beta\), where \(a, \beta \in R ; \beta > 0\).

The probability density function is given by:

\[\begin{split}f_{a, \beta}(x) = \begin{cases} \frac{1}{\beta} \exp (-\frac{(x-a)}{\beta}), & x \geq a \\ 0, & x < a \end{cases}, - \infty < x < + \infty\end{split}\]

The cumulative distribution function is as follows:

\[\begin{split}F_{a, \beta}(x) = \begin{cases} 1 - \exp (-\frac{(x-a)}{\beta}), & x \geq a \\ 0, & x < a \end{cases}, - \infty < x < + \infty\end{split}\]

class exponential#

Syntax

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

    exponential();
    explicit exponential(RealType a, RealType beta);

    RealType a() const;
    RealType beta() const;
  };
}

Template parameters

typename RealType

Type of the produced values. Supported types:

  • float

  • double

typename Method = oneapi::mkl::rng::exponential_method::by_default

Generation method. The specific values are as follows:

  • oneapi::mkl::rng::device::exponential_method::by_default

  • oneapi::mkl::rng::device::exponential_method::icdf

  • oneapi::mkl::rng::device::exponential_method::icdf_accurate

See description of the methods in Distributions methods template parameter.

Class Members

Routine

Description

exponential()

Default constructor

explicit exponential(RealType a, RealType beta)

Constructor with parameters

RealType a() const

Method to obtain displacement value

RealType beta() const

Method to obtain scalefactor

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

exponential::exponential()

Description

Default constructor for distribution, parameters set as a = 0.0, beta = 1.0.

explicit exponential::exponential(RealType a, RealType beta)

Description

Constructor with parameters. a is a displacement, beta is a scalefactor.

Throws

oneapi::mkl::invalid_argument

Exception is thrown when \(beta \leq 0\)

Characteristics

RealType exponential::a() const

Return Value

Returns the distribution parameter a - displacement.

RealType exponential::beta() const

Return Value

Returns the distribution parameter beta - scalefactor value.

Parent topic: Device Distributions