#ifdef _cplusplus extern "C" { #endif #include "probability.h" /* Function: Probability_from_average_state_occupancy(length) * * Descrip: for single state (exponetial decays) takes an average length * and converts that to a probability that will produce that * length (on average) for the state. NB... this *assumes* that * you want a single state exp decay. * * * Arg: length [UNKN ] average length of state [double] * * Return [UNKN ] Undocumented return value [Probability] * */ # line 44 "probability.dy" Probability Probability_from_average_state_occupancy(double length) { return 1 - (1.0 / length); } /* Function: state_occupancy_from_Probability(p) * * Descrip: If you have a single state then this will tak * the probability for the state->state transition and * give you back the average length in the state * * * Arg: p [UNKN ] probability of staying in the state [double] * * Return [UNKN ] Undocumented return value [double] * */ # line 56 "probability.dy" double state_occupancy_from_Probability(double p) { return 1 / (1-p); } /* Function: Probability_logsum(one,two) * * Descrip: gives back a score of the sum in * probability space of the two scores. * * This is the function verison of this * code, which is not efficient *at all* * * * Arg: one [UNKN ] Undocumented argument [Score] * Arg: two [UNKN ] Undocumented argument [Score] * * Return [UNKN ] Undocumented return value [Score] * */ # line 68 "probability.dy" Score Probability_logsum(Score one,Score two) { return Probability2Score(Score2Probability(one) + Score2Probability(two)); } /* Function: show_Score_array(s,len,ofp) * * Descrip: shows a score array as score, score ,score ...' * * * Arg: s [UNKN ] Score array [Score *] * Arg: len [UNKN ] length of array [int] * Arg: ofp [UNKN ] output filestream [FILE *] * */ # line 80 "probability.dy" void show_Score_array(Score * s,int len,FILE * ofp) { register int i; fprintf(ofp,"\"%d",s[0]); for(i=1;i= len ) { return FALSE; } if( is_double_string(runner,&p[no]) == FALSE ) { return FALSE; } } return TRUE; } /* Function: show_Probability_array(p,len,ofp) * * Descrip: shows a proability array in %f notation. * * * * Arg: p [UNKN ] probability array [Probability *] * Arg: len [UNKN ] length of proability array [int] * Arg: ofp [UNKN ] output filestream [FILE *] * */ # line 143 "probability.dy" void show_Probability_array(Probability * p,int len,FILE * ofp) { register int i; fprintf(ofp,"\"%f",p[0]); for(i=1;i