[Boost-bugs] [Boost C++ Libraries] #1437: normal_distribution.hpp, improvements to distribution and possibly speed

Subject: [Boost-bugs] [Boost C++ Libraries] #1437: normal_distribution.hpp, improvements to distribution and possibly speed
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-11-13 09:01:02


#1437: normal_distribution.hpp, improvements to distribution and possibly speed
-----------------------------------+----------------------------------------
 Reporter: m.bannerman_at_[hidden] | Type: Patches
   Status: new | Milestone: To Be Determined
Component: random | Version: Boost 1.34.1
 Severity: Optimization | Keywords: random normal distribution box muller transform gaussian
-----------------------------------+----------------------------------------
 Hello,
 I have adapted the current normal_distribution from the polar form to
 the outward Cartesian form. See here
 http://web.mat.bham.ac.uk/marijke/bm/yabm.pdf
 listing the benefits of the Cartesian form for the distribution of
 numbers. This also eliminates trigonometric function calls, however,
 it does reject pairs of random numbers. Most websites (wolfram,
 wikipedia) state that the inward Cartesian form is faster but this is
 generator speed dependent.

 I've found with my tests
 (mt19937, double datatype, gcc (GCC) 4.1.3 20070929 (prerelease)
 (Ubuntu 4.1.2-16ubuntu2), -O2)
 its about 1.5x slower than the polar form. Although with faster
 generators I expect it to outperform the polar version.

 I think this is an improvement on the current normal_distribution.hpp
 in time critical situations (if a fast generator is used) and it gives
 a better distribution of numbers, (points rather than bands of
 inaccessible numbers). I have also found that this version doesn't
 produce the "may be used uninitialised" warning when compiling with
 optimisations that I get when I use the original.

 Posted to boost.developers 2007-11-11

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1437>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC