/* * mcmc.cpp * * Created on: May 14, 2013 * Author: abduz */ #include "inc/mcmc.hpp" mcmc::mcmc(int np,double (*f)(vec&,void*),void *p) { npar = np; loglikelihood = f; ptr = p; hqrndrandomize(rnd); nrun = 100; nburn = 100; nwk = 100; ncheck = 10;avalue = 2.0; } mcmc::~mcmc() {} void mcmc::run( vec& p, vec& pe, const char*fname){ int i,j,k,nacc,nr,n,nsum; vec2 pars; pars.setlength(nwk,npar); vec prob,currp,bestp,sum,sum2; ivec2 compj; double bestlike,tmplike=-1e20,z,q,a1=1./sqrt(avalue),a2=sqrt(avalue);; prob.setlength(nwk);currp.setlength(npar);bestp.setlength(npar);sum.setlength(npar);sum2.setlength(npar); compj.setlength(nwk,nwk-1); nsum=0;for(i=0;i-1e10 ){ nacc++;for(i=0;inburn) { for(i=0;i