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

Marc Glisse marc.glisse@inria.fr
Wed Jul 23 09:58:00 GMT 2014


On Sat, 12 Jul 2014, Ulrich Drepper wrote:

> Ed's submission of the logistic regression distribution caused problems
> for me because, like Ed, I have changes to the <ext/random> header in my
> tree for a long time.  Time to submit them.
>
> This first one is a new distribution.  It generates coordinates for
> random points on a unit sphere in arbitrarily many dimensions.  This
> distribution by itself is useful but if I get some other code fully
> implemented it will also form the basis for yet another, more
> sophisticated distribution.

Hello,

I have 2 questions :

* can't we end up dividing by 0 if all values of the normal distribution 
happen to be 0?

* should the implementation be specialized for small dimensions to avoid 
the normal distributions and instead generate points in a square/cube 
until they fall in the disk/ball?

-- 
Marc Glisse



More information about the Libstdc++ mailing list