ADMB Documentation  11.1.2495
 All Classes Files Functions Variables Typedefs Friends Defines
df1b2-separable/vgamdens.cpp
Go to the documentation of this file.
00001 #include <df1b2fun.h>
00002 
00007   df1b2variable gamma_density(const df1b2variable& _x,double r, double mu)
00008   {
00009     df1b2variable& x= (df1b2variable&)(_x);
00010 
00011     return exp(r*log(mu) + (r-1)*log(x)-mu*x-gammln(r));
00012   }
00013 
00018   df1b2variable gamma_density(const df1b2variable& _x,const df1b2variable& _r,
00019     const  df1b2variable& _mu)
00020   {
00021     df1b2variable& x= (df1b2variable&)(_x);
00022     df1b2variable& r= (df1b2variable&)(_r);
00023     df1b2variable& mu= (df1b2variable&)(_mu);
00024     return exp(r*log(mu) + (r-1)*log(x)-mu*x-gammln(r));
00025   }
00026 
00031   df1b2variable log_gamma_density(const df1b2variable& _x,double r, double mu)
00032   {
00033     df1b2variable& x= (df1b2variable&)(_x);
00034 
00035     return r*log(mu) + (r-1)*log(x)-mu*x-gammln(r);
00036   }
00037 
00042 df1b2variable log_gamma_density(const df1b2variable& _x,
00043   const df1b2variable& _r, const  df1b2variable& _mu)
00044   {
00045     df1b2variable& x= (df1b2variable&)(_x);
00046     df1b2variable& r= (df1b2variable&)(_r);
00047     df1b2variable& mu= (df1b2variable&)(_mu);
00048     return r*log(mu) + (r-1)*log(x)-mu*x-gammln(r);
00049   }