From: Paul A Bristow (pbristow_at_[hidden])
Date: 2007-12-24 07:08:20
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Joel Eidsath
>Sent: 22 December 2007 23:02
>Subject: [boost] [random] poisson_distribution problem and fix
>The poisson_distribution code will fail for any mean larger than 750
>or so (on my x86_64 machine). The problem is a comparison with
>exp(-_mean) which evaluates as zero right around there.
>A far better fix would be to use an algorithm other than Knuth's for
>this. Knuth's algorithm is simple, but O(n). Here is some code I
>wrote, converting some old Fortran code that a friend had got from
>Numerical Recipes once upon a time. It works, but would need actual
>testing before use in production code:
This looks too obviously lifted from NR in C (or FORTRAN) to fit the Boost license.
But the algorithm should still be usable? (But I am not qualified to judge).
ln gamma (and poisson) is available from the Math Toolkit, but this is a random requirement and you may value speed more than
--- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk