1 #ifndef MATHUTIL_H 2 #define MATHUTIL_H 3 4 #include <cmath> 5 #include <vector> 6 7 /** The input array contains a set of log probabilities lp1, lp2, lp3 8 ... The return value should be the log of the sum of the 9 probabilities: log(e^lp1 + e^lp2 + e^lp3 + ...) */ 10 double sumLogProb(std::vector<double>& logprobs); 11 12 /** returns log (e^logprob1 + e^logprob2). */ 13 double sumLogProb(double logprob1, double logprob2); 14 15 #endif 16