Question

I am seeking a C or C++ version of gamma and log gamma functions.

Are there any code pieces or libraries recommended?

If possible, I want to know the principle of the implementations.

Thank you!!!

Was it helpful?

Solution 2

If you can't use C++11: The GNU GSL has all Gamma function you would ever need: http://www.gnu.org/software/gsl/manual/html_node/Gamma-Functions.html#index-gsl_005fsf_005flngamma-583

Or you can have a look at boost's math special functions: http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/lgamma.html

OTHER TIPS

In c++11, you can use std::lgamma for log gamma, and tgamma for gamma.

You can try to have a look at Numerical Recipes In C, it should contain the functions you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top