C++ Source Code For Calculation Of Gamma Cdf
3
0
Entering edit mode
13.1 years ago
Isar ▴ 30

Hi I seek a source code of program in C++ which calculate CDF of Gamma distribution for me. Do you know where I can find this program or its algorithm? Isar PhD student of Bioinformatics Isar Nassiri@gmail.com

c code • 8.9k views
ADD COMMENT
3
Entering edit mode
13.1 years ago
lh3 33k

kfunc.c from samtools. It implements complete and incomplete gamma functions. Then it is straightforward to calculate CDF. Samtools also comes with a few other gems C programmers may be interested in (e.g. Fisher's exact test; Brent's method; sorting; hash table; fasta/fastq parser; ...).

EDIT: You can also use GSL. Samtools does not use GSL because GSL is GPL'ed, while samtools is licensed under MIT. Even if GSL were released in a permissive license, it would always be a bad idea to request the users to install a non-standard library GSL for a simple function like an incomplete gamma function. If you write programs for yourself, all these concerns do not matter to you. GSL is a great general numerical library.

For C++ programmers, boost is a great resource for special mathematical functions (incomplete gamma function) and many other things. You may copy-paste boost source code if you do not like dependencies.

ADD COMMENT
1
Entering edit mode
13.1 years ago
Niek De Klein ★ 2.6k

Try this: http://www.codecogs.com/code/statistics/distributions/continuous/gamma/cdf.php, you do need a commercial license for the source code.

ADD COMMENT
1
Entering edit mode
13.1 years ago
Fabian Bull ★ 1.3k

You can find source code in Numerical Recipes. If you dont have it. Buy it! Its worth its weight in gold. An academic library should also work.

ADD COMMENT

Login before adding your answer.

Traffic: 2727 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6