gtfold/gtfold — pull request #68 by msoni3 (2012-02-25 21:52:13+00:00)
Title: d2 sampling error for multiloop sequences removed

consistent use of b and c thought out program.
In order to ensure sum of probabilities always 1 in the program, here is the format of all of sampling functions, (assert(0) will throw exception if program reaches that line, program should not reach that line)
void StochasticTracebackD2::rnd_s2(int i, int h, int j){
MyDouble rnd = randdouble();
MyDouble cum_prob(0.0);
for (int l = h+1; l < j; ++l)
{
cum_prob = cum_prob + S2_ihlj(i,h,l,j);
if (rnd < cum_prob){//do energy computation etc and return;}
}
assert(0);
}