This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] libstdc++: add uniform on sphere distribution
- From: Ulrich Drepper <drepper at gmail dot com>
- To: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Cc: Jonathan Wakely <jwakely at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 9 Aug 2014 11:24:29 -0400
- Subject: Re: [PATCH] libstdc++: add uniform on sphere distribution
- Authentication-results: sourceware.org; auth=none
- References: <87a98eow4m dot fsf at x240 dot local dot i-did-not-set--mail-host-address--so-tickle-me> <alpine dot DEB dot 2 dot 11 dot 1407231149300 dot 1768 at laptop-mg dot saclay dot inria dot fr> <20140723102908 dot GM2361 at redhat dot com> <87d2catvi3 dot fsf at x240 dot local dot i-did-not-set--mail-host-address--so-tickle-me> <alpine dot DEB dot 2 dot 11 dot 1408090904200 dot 10998 at stedding dot saclay dot inria dot fr> <CAOPLpQePn5FO_5PsazROOi3PfmRXx6y7mwoYo5h2+h3TZnX-gQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 11 dot 1408091413520 dot 10998 at stedding dot saclay dot inria dot fr>
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.