/* Last edited: Apr 23 14:10 1997 (birney) */ %{ #include "wisebase.h" #define LOG_NEGATIVE_INFINITY (-100000) #define NEGI LOG_NEGATIVE_INFINITY #define PROBABILITY_MINIMUM (0.00000000001) #define INTEGER_FACTOR 500 typedef double Probability; typedef int Score; typedef double Bits; #define MINIMUM_ERROR (0.00000001) %} api func Probability_from_average_state_occupancy func state_occupancy_from_Probability func Probability2Score func Score2Probability func Score2Bits func halfbit2Probability endapi %{ #include "probability.h" %func 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 average length of state %% Probability Probability_from_average_state_occupancy(double length) { return 1 - (1.0 / length); } %func 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 probability of staying in the state %% double state_occupancy_from_Probability(double p) { return 1 / (1-p); } %func 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* %% Score Probability_logsum(Score one,Score two) { return Probability2Score(Score2Probability(one) + Score2Probability(two)); } %func shows a score array as score, score ,score ...' %arg s Score array len length of array ofp output filestream %% 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; } %func shows a proability array in %f notation. %arg p probability array len length of proability array ofp output filestream %% void show_Probability_array(Probability * p,int len,FILE * ofp) { register int i; fprintf(ofp,"\"%f",p[0]); for(i=1;i