arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1810.04744stat.COphysics.comp-ph
收藏

带Zest的单模无界Probability Density Functions的广义Ziggurat算法

Generalized Ziggurat Algorithm for Unimodal and Unbounded Probability Density Functions with Zest

Morteza Jalalvand, Mohammad A. Charsooghi

摘要:

我们提出了一种改进的Ziggurat算法,可以产生一个随机数从所有的单峰和无界PDF。对于具有无界密度和/或无界支持的PDF,我们使用非线性映射函数和拒绝抽样的组合来从峰值和/或尾部分布生成随机数。一族映射函数及其相应的接受概率函数(以及他们的使用和他们的效率的标准),可以用来产生随机数从无限的尾巴和无界密度。Zest库是该算法的C++实现。Zest可以有效地生成正态、指数、柯西、伽玛、威布尔、对数正态、卡方、学生t和Fisher f变量。用户还可以将他们的自定义PDF定义为一个类,并将其作为模板参数提供给我们的库的类,而无需修改库的任何部分。Zest的性能与标准模板库(STL)和Boost的随机模块(GCC的实现)的性能进行了比较。结果表明,在大多数情况下,Zest比两者都快,有时超过10倍。我们还提出了一个C++实现的一个统一的浮点随机数发生器(RNG),这是能够产生的所有可表示的浮点数在$[0,1)$,这将被用于在Ziggurat算法附近的无界峰和尾。用随机整数除以RNG的范围的常用方法不能产生具有完全随机小数位和非常小的随机数的随机浮点数。所提出的均匀浮点RNG是非常有效的,在产生双精度浮点数的情况下,它甚至比简单地将64位整数乘以$2^{-64}$更快。

英文摘要:

We present a modified Ziggurat algorithm that could generate a random number from all unimodal and unbounded PDFs. For PDFs that have unbounded density and/or unbounded support we use a combination of nonlinear mapping function and rejection sampling to generate a random number from the peak and/or the tail distribution. A family of mapping functions and their corresponding acceptance probability functions are presented (along with the criteria for their use and their efficiency) that could be used to generate random numbers from infinite tails and unbounded densities. The Zest library which is a C++ implementation of this algorithm is also presented. Zest can efficiently generate normal, exponential, cauchy, gamma, Weibull, log-normal, chi-squared, student's t and Fisher's f variates. The user can also define their custom PDF as a class and supply it as a template argument to our library's class without modifying any part of the library. Performance of Zest is compared against performance of random modules of (GCC's implementation of) Standard Template Library (STL) and Boost. The presented results show that Zest is faster than both in most cases, sometimes by a factor of more than 10. We also present a C++ implementation of a uniform floating-point random number generator (RNG) which is capable of producing all representable floating-point numbers in $[0,1)$ which will be used in the Ziggurat algorithm near unbounded peaks and tails. The common method of dividing a random integer by the range of the RNG can not produce random floating-point numbers with fully random fraction bits and very small random numbers. The presented uniform floating-point RNG is very efficient and in the case of producing double precision floating-point numbers it's even faster than simply multiplying a 64-bit integer by $2^{-64}$.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑