#include #include #include #include "nr.h" using namespace std; extern int idum; void NR::vegas(Vec_I_DP ®n, DP fxn(Vec_I_DP &, const DP), const int init, const int ncall, const int itmx, const int nprn, DP &tgral, DP &sd, DP &chi2a) { const int NDMX=50, MXDIM=10; const DP ALPH=1.5, TINY=1.0e-30; static int i,it,j,k,mds,nd,ndo,ng,npg; static DP calls,dv2g,dxg,f,f2,f2b,fb,rc,ti; static DP tsi,wgt,xjac,xn,xnd,xo,schi,si,swgt; static Vec_INT ia(MXDIM),kg(MXDIM); static Vec_DP dt(MXDIM),dx(MXDIM),r(NDMX),x(MXDIM),xin(NDMX); static Mat_DP d(NDMX,MXDIM),di(NDMX,MXDIM),xi(MXDIM,NDMX); int ndim=regn.size()/2; if (init <= 0) { mds=ndo=1; for (j=0;j= 0) { mds = -1; npg=ng/NDMX+1; nd=ng/npg; ng=npg*nd; } } for (k=1,i=0;i= 0) { cout << " Input parameters for vegas"; cout << " ndim= " << setw(4) << ndim; cout << " ncall= " << setw(8) << calls << endl; cout << setw(34) << " it=" << setw(5) << it; cout << " itmx=" << setw(5) << itmx << endl; cout << setw(34) << " nprn=" << setw(5) << nprn; cout << " ALPH=" << setw(9) << ALPH << endl; cout << setw(34) << " mds=" << setw(5) << mds; cout << " nd=" << setw(5) << nd << endl; for (j=0;j