// This Stan block defines a Gamma model, by Sean van der Merwe, UFS
data {
  int<lower=1> n;   			        // number of observations
  real<lower=0> y[n];       // observations
}
// The parameters of the model
parameters {
  real<lower=0> a;                 
  real<lower=0> l;                 
}
model {
  y ~ gamma(a, l);
  target += 0.5*log(a*trigamma(a)-1) - log(l);
}

CXXFLAGS = -O2 -Wall $(DEBUGFLAG) -mfpmath=sse -msse2 -mstackrealign $(LTO)