Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2007-12-26 04:44:53


Joel Eidsath wrote:
> Paul A. Bristow wrote:
>> This looks too obviously lifted from NR in C (or FORTRAN) to fit the
>> Boost license.
>
> Yes, as I mentioned, it's from a NR FORTRAN recipe. I don't know if
> the conversion from FORTRAN to C++ makes it a non-derivative work. The
> code certainly wouldn't work in poisson_distribution.hpp as is.

A direct or mechanical conversion almost certainly does make it a derived
work of the NR original: the best way is to go back to the original
reference if possible and work from there. One recent reference is:

Ahrens, J.H. and Dieter, U. (1982).
Computer generation of Poisson deviates from modified normal distributions.
ACM Trans. Math. Software 8, 163-179.

>> But the algorithm should still be usable? (But I am not qualified to
>> judge).
>>
>
> If not, then at least the fix (in the original part of my post)
> should be used.
>
> Right now, using [random] poisson_distribution is slow and dangerous
> for any mean over 750. If it is changed to use ln instead of exp, it
> will only be slow. That is completely unrelated to the NR code later
> on in my post, which is a (serious) speed optimization.
>
>> ln gamma (and poisson) is available from the Math Toolkit, but this
>> is a random requirement and you may value speed more than accuracy?
>
> I don't see any way to use the Math Toolkit poisson distribution code
> to actually generate poisson random variables.

You *could* apply the poisson quantile to a uniformly distributed variable
to obtain a
poisson one, but I wouldn't honestly recommend it for that purpose :-/

I'll look into the Poisson PDF issue,

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk