Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2007-11-12 12:01:20


>-----Original Message-----
>From: boost-bounces_at_[hidden]
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Marcus Bannerman
>Sent: 12 November 2007 08:44
>To: boost_at_[hidden]
>Subject: [boost] [random] normal_distribution,cartesian form
>of box-muller transform
>I have adapted the current normal_distribution from the polar form to
>the outward Cartesian form. See here
>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.
>Please let me know if you think of any other improvements or spot any
>errors. I will use this in my code however I would like to give
>something back.

This sounds a clear improvement but I'm not sure how to suggest it should be incorporated into future releases. At the very least
you should put it in the Boost sandbox with a covering text file?

>I'm not sure what to do with the copyright at the top of the file.

You should simply add your own line

Copyright Marcus Bannerman 2007

underneath the existing copyright to read thus

Copyright Jens Maurer 2000-2001
Copyright Marcus Bannerman 2007

Distributed under the Boost Software License, Version 1.0.
It might help also to add you initials to the revision history line?...



Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539561830 & SMS, Mobile +44 7714 330204 & SMS

Boost list run by bdawes at, gregod at, cpdaniel at, john at