#include #include #include #include #include #include using namespace std; //introduces namespace std long double thetalikeli (long int, long int, long double); long double divlikeli (long int, long double, long double); long double factorial(long double); long double HKAlikeli (long double[52]); #define LOCI 100 double drand48(void); void srand48(long int seedval); int main( void ) { ofstream outfile ("likelihoods.txt"); ifstream infile ("infile.txt"); if (!infile) { //print error message to standard error stream: cerr << "Can not open input file" << endl; exit(1);} long double L[LOCI]; long int SEED; long double k[LOCI],maxmaxlik, maxmaxk[LOCI],d[LOCI], maxmaxtime,maxmaxth[LOCI],kmax[LOCI],scalar[LOCI],th[LOCI],Like, time, maxlik,timemax,thmax[LOCI]; /*int name, run, start; -mpc */ long int test, CHAIN, m, w, x, r, p, locus[LOCI], mod, n[LOCI], S[LOCI], y, b, h, zz; string locusname[LOCI], locussel[LOCI]; cout << "SEED? "; infile >> r; if (r>100) { cout << "Error: maximum 100 loci."; exit(1); } infile >> mod; if (mod>0) { for (zz=0;zz> locussel[zz]; } infile >> time; cin>> SEED; srand48(SEED); cout << " Chain length?"; cin>>CHAIN; maxlik=-100000000; cout <<" number of loci: " <>locusname[h]>> L[h]>>S[h] >>n[h]>>d[h]>>th[h] >> scalar[h]; for ( test = 0; test < mod; test++ ) { if ( locusname[h]==locussel[test] ) {locus[test]=h+1; } } } long int counter,set; set=1; counter=0; timemax=0; for (p=0; pmaxlik) { if (Like>maxmaxlik) {maxmaxlik=Like; maxmaxtime=time; for (y=0; y10000 && kor<11000) { if (drand48()1) { temp = temp * (numbe-1); numbe=(numbe-1); } return temp; }