[PATCH] libstdc++: add uniform on sphere distribution

Ulrich Drepper drepper@gmail.com
Sat Aug 9 15:24:00 GMT 2014


On Sat, Aug 9, 2014 at 8:34 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Oh, a comment saying exactly what you just said would be fine with me (or
> even nothing).

We might at some point use a different method than Box-Muller sampling
so I'm OK with the test.


> If you are going to specialize for dim 2, I imagine you won't be computing
> normal distributions, you will only generate a point uniformy in a square
> and reject it if it is not in the ball? (interestingly enough this is used
> as a subroutine by the implementation of normal_distribution)

We need to be *on* the circle, not inside.  We'll still have to follow
the algorithm unless I miss something.  With reasonable probability we
cannot generate those numbers directly from a uniform source. What is
optimized is just the norm computation.



More information about the Libstdc++ mailing list