ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
df1b2-separable/vgamdens.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
7 #include <df1b2fun.h>
8 
13  df1b2variable gamma_density(const df1b2variable& _x,double r, double mu)
14  {
15  df1b2variable& x= (df1b2variable&)(_x);
16 
17  return exp(r*log(mu) + (r-1)*log(x)-mu*x-gammln(r));
18  }
19 
25  const df1b2variable& _mu)
26  {
27  df1b2variable& x= (df1b2variable&)(_x);
28  df1b2variable& r= (df1b2variable&)(_r);
29  df1b2variable& mu= (df1b2variable&)(_mu);
30  return exp(r*log(mu) + (r-1)*log(x)-mu*x-gammln(r));
31  }
32 
37  df1b2variable log_gamma_density(const df1b2variable& _x,double r, double mu)
38  {
39  df1b2variable& x= (df1b2variable&)(_x);
40 
41  return r*log(mu) + (r-1)*log(x)-mu*x-gammln(r);
42  }
43 
49  const df1b2variable& _r, const df1b2variable& _mu)
50  {
51  df1b2variable& x= (df1b2variable&)(_x);
52  df1b2variable& r= (df1b2variable&)(_r);
53  df1b2variable& mu= (df1b2variable&)(_mu);
54  return r*log(mu) + (r-1)*log(x)-mu*x-gammln(r);
55  }
double gammln(double xx)
Log gamma function.
Definition: combc.cpp:52
#define x
double gamma_density(double x, double r, double mu)
Gamma probability density function; constant objects.
Definition: cgamdens.cpp:21
Description not yet available.
Definition: df1b2fun.h:266
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
Description not yet available.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2a.cpp:13
double log_gamma_density(double x, double r, double mu)
Log gamma probability density function; constant objects.
Definition: cgamdens.cpp:35