double harmonicmarginlikecalc(int k) { double hmlog; int gi, zadj; int pdgp; int tempz; double tempm; struct extendnum *harmonicsump; int maxz = 0; double harmonicsum_eexp = 0.0; harmonicsump = (struct extendnum *) malloc ((size_t) ((genealogiessaved + 1) * sizeof (struct extendnum))); pdgp = 4*numpopsizeparams + 3* nummigrateparams; // position in gsampinf[gi] that holds pdg for (gi = 0; gi < genealogiessaved; gi++) { eexp(gsampinf[gi][pdgp],&tempm,&tempz); harmonicsump[gi].m = 1.0/tempm; harmonicsump[gi].z = -tempz; if (harmonicsump[gi].z > maxz) maxz = harmonicsump[gi].z; } for (gi = 0; gi < genealogiessaved; gi++) { zadj = harmonicsump[gi].z - (maxz - OCUTOFF); harmonicsum_eexp += harmonicsump[gi].m * pow (10.0, (double) zadj); } hmlog = -(log (harmonicsum_eexp) - log( (double) genealogiessaved) + (maxz - OCUTOFF) * LOG10); XFREE(harmonicsump); return hmlog; }
char *proobraz(char* input) { input = registr(input); input= ficha(input); for (int i=0;i<strlen(input);i++) { ssin(i,input); ccos(i,input); aasin(i,input); aacos(i,input); aatan(i,input); cceil(i,input); cch(i,input); eexp(i,input); aabs(i,input); ffloor(i,input); lln(i,input); llog(i,input); ssh(i,input); ssqrt(i,input); ttan(i,input); tth(i,input); cctg(i,input); aactg(i,input); ccth(i,input); } return input; }