/usr/include/osl/stat/probability.h is in libosl-dev 0.6.0-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* probability.h
*/
#ifndef _STAT_PROBABILITY_H
#define _STAT_PROBABILITY_H
#include <algorithm>
#include <cmath>
namespace osl
{
namespace stat
{
struct Probability
{
unsigned long numerator, denominator;
explicit Probability(unsigned long n=0, unsigned long d=0)
: numerator(n), denominator(d)
{
}
double probability(double stabilizer=1.0) const
{
return std::max(stabilizer,numerator-stabilizer)
/ std::max(stabilizer,static_cast<double>(denominator));
}
double logProb(unsigned int stabilizer=1u) const
{
const double prob = probability(stabilizer);
return log(prob)/log(0.5)*100;
}
void merge(const Probability& other)
{
numerator += other.numerator;
denominator += other.denominator;
}
};
} // namespace stat
} // namespace osl
#endif /* _STAT_PROBABILITY_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|