#include #include "multinomial.h" /* this is a test example taken from the paper ,see multinomial.c * gcc -Wall -static -g test.c multinomial.c -lgsl -lm * or * gcc -Wall -Xlinker --allow-shlib-undefined -g test.c multinomial.c -lgsl -lm * (Not sure whay it needs the allow-shlib-undefined, but otherwise lots of unresolved cblas errors) */ int main() { double p[12], res, lb, ub; unsigned int n[12]; int i; for(i=0; i<12; i++ ) { p[i] = 1/12.0; n[i] = 3; } res = cdf_multinomial_P(12,12,p,n); /* Result should be 0.8367 */ printf("%g\n", res); /* Result should be (0.8340,0.8461) */ cdf_multinomial_BMboundsP(12,12,p,n,&lb,&ub); printf("(%g,%g)\n", lb, ub); res = cdf_multinomial_Pmax(12,12,3); /* Result should be 0.8367 */ printf("%g\n", res); return(0); }