SBProfile code Poisson.cpp uses some NR routines (gammp, gammq, gser, gcf) with very little alteration to build a Poisson deviate from a uniform deviate. Mike gave some references for implementing the incomplete gamma function:
http://en.wikipedia.org/wiki/Incomplete_gamma_function
http://oai.cwi.nl/oai/asset/10080/10080A.pdf
http://www.alglib.net/specialfunctions/incompletegamma.php
http://www.gnu.org/software/gsl/manual/html_node/Incomplete-Gamma-Functions.html
He points out that "The first two could be used to roll our own. The next two are GPL, so we could include those in our stack."
SBProfile code Poisson.cpp uses some NR routines (gammp, gammq, gser, gcf) with very little alteration to build a Poisson deviate from a uniform deviate. Mike gave some references for implementing the incomplete gamma function:
http://en.wikipedia.org/wiki/Incomplete_gamma_function
http://oai.cwi.nl/oai/asset/10080/10080A.pdf
http://www.alglib.net/specialfunctions/incompletegamma.php
http://www.gnu.org/software/gsl/manual/html_node/Incomplete-Gamma-Functions.html
He points out that "The first two could be used to roll our own. The next two are GPL, so we could include those in our stack."