Skip to content

Commit

Permalink
unspecify methods
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyfe1 committed Jul 29, 2024
1 parent 6f8fa52 commit edd189d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,80 +48,5 @@ Distributions Template Parameter Method
* Triangle
* Left exponential tail
* Right exponential tail
* - ``beta_method::cja``
``beta_method::cja_accurate``
- ``beta``
- Acceptance/rejection method depending on the parameters of the distribution, ``p`` and ``q``:

* If ``max(p,q) < 1``, beta distributed variates are obtained by means of
composition of two algorithms (below constants K and C are such that
``K~=0.852``, ``C~=-0.956`` ):

* if ``q+K*p^2+C<=0``, method of Johnk is used (see References 1. for details);
* if ``q+K*p^2+C>0``, switching method of Atkinson is used (see
References 2. for details). In the method of Atkinson interval ``(0,1)``
is divided into two parts, ``(0,t)`` and ``(t,1)``, where
``t=sqrt(p*(1-p))/(sqrt(p*(1-p))+sqrt(q*(1-q)))``. Then the
acceptance/rejection technique is applied on each of these
intervals.
* If ``p < 1`` and ``q > 1``, switching algorithm of Atkinson with
``t=(1-p)/(q+1-p)`` is used;
* If ``p < 1`` and ``q > 1``, switching algorithm of Atkinson with
interchanging parameters, ``p`` and ``q`` and ``t=(1-p)/(q+1-p)`` is used.
After generation ``x`` using the algorithm random number ``1 - x`` is returned
as required result.
* If ``min(p,q) > 1``, algorithm of Cheng is used. This method based on
acceptance/rejection technique operates by obtaining beta variates
of the second kind and making their transformation to beta variates
of the first kind (see References 3. for details);
* If ``p = 1`` and ``q`` is arbitrary positive number inverse cumulative
distribution function (ICDF) method is used;
* If ``q = 1`` and ``p`` is arbitrary positive number inverse cumulative
distribution function (ICDF) method is used;
* If ``p = 1`` and ``q = 1`` beta distribution reduces to uniform distribution
over ``(0,1)`` interval.

* - ``gamma_method::marsaglia``
``gamma_method::marsaglia_accurate``
- ``gamma``
- Acceptance/rejection method depending on the :math:`\alpha` parameter of the distribution:

* If :math:`\alpha > 1` method of Marsaglia and Tsang is used.
This algorithm is based on the acceptance/rejection
method using squeeze technique (see References 4. for details). Gaussian random
numbers are generated by means of the Box-Muller 2 method. Due to
nature of the Box-Muller algorithm (pair of uniformly distributed
random number is transformed into pair of standard normal numbers) to
calculate ``n`` gamma variates one always generates even number of normal
and uniformly distributed random numbers. If the last pair
of gaussian and uniformly distributed random numbers is not used it is
saved for later usage.
* If :math:`\alpha = 1` gamma distribution reduces to exponential distribution
with parameters ``(0,1)``.
* If :math:`\alpha \geq 0.6` and :math:`\alpha < 1` modified method of Vaduva is used.
Gamma distributed random number is generated using rejection from
the Weibull distribution (see References 5. and 6. for details).
* If :math:`\alpha < 0.6` gamma distributed random number is got by transformation
of random variate with exponential power distribution (EPD). EPD random
number is obtained using acceptance/rejection method. The algorithm for
generation of gamma variate with parameter :math:`\alpha < 1` is a specific case of
acceptance/rejection method used for generation of EPD random number.
(see References 6. for details).

References
==========

#. M.D. Johnk, Erzeugung von Betaverteilten und Gammaverteilten Zufallszahlen, Metrika, 8, 5-15, 1964
#. A.C. Atkinson, A family of switching algorithms for the computer
generation of beta random variables. Biometrika, 66, 1, 141-145, 1979
#. Cheng R.C.H. Generating Beta variates with Nonintegral Shape
Parameters, Communications of the ACM, 21, 4, 317-322, 1978.
#. G. Marsaglia, and W.W. Tsang, A simple method for generating gamma
variables. ACM Transactions on Mathematical Software, vol. 26, No. 3, 363-372, September 2000.
#. I. Vaduva, On computer generation of gamma random variables by
rejection and composition procedures. Mathematische Operationsforschung
und Statistik, Series Statistics, vol. 8, 545-576, 1977.
#. L. Devroye, Non-Uniform Random Variate Generation, Springer-Verlag, New York, 1986.


`NOTE:` Methods provided for exposition purposes.
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,8 @@ class beta

.. container:: section

typename Method = oneapi::mkl::rng::beta_method::by_default
Generation method. The specific values are as follows:

* ``oneapi::mkl::rng::device::beta_method::by_default``
* ``oneapi::mkl::rng::device::beta_method::cja``
* ``oneapi::mkl::rng::device::beta_method::cja_accurate``

See description of the methods in :ref:`Distributions methods template parameter<onemkl_device_rng_distributions_method>`.
typename Method
Generation method. The type is unspecified.


.. container:: section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,8 @@ class gamma

.. container:: section

typename Method = oneapi::mkl::rng::gamma_method::by_default
Generation method. The specific values are as follows:

* ``oneapi::mkl::rng::device::gamma_method::by_default``
* ``oneapi::mkl::rng::device::gamma_method::marsaglia``
* ``oneapi::mkl::rng::device::gamma_method::marsaglia_accurate``

See description of the methods in :ref:`Distributions methods template parameter<onemkl_device_rng_distributions_method>`.
typename Method
Generation method. The type is unspecified.


.. container:: section
Expand Down

0 comments on commit edd189d

Please sign in to comment.