项目作者: renatocf

项目描述 :
A fast implementation of probabilities, using log-probabilities
高级语言: C++
项目地址: git://github.com/renatocf/probability.git
创建时间: 2016-05-16T23:49:23Z
项目社区:https://github.com/renatocf/probability

开源协议:GNU General Public License v3.0

下载


Probability

Travis
Codecov

A fast implementation of probabilities / positive floating point arithmetic using logarithms.

Usage

This library is header only, which means you can copy it and use it with a simple include:

  1. #include "probability/probability.hpp"

We provide aliases for the most common uses:

Type Definition
log_float_t Logarithm floating point with value type float
log_double_t Logarithm floating point with value type double
log_long_double_t Logarithm floating point with value type long double
probability_float_t Probability with base type float
probability_double_t Probability with base type double
probability_long_double_t Probability with base type long double
probability_t Alias to probability_double_t

The library defines a class LogFloatingPoint with 3 template parameters:

  • T, the value type, used for internal storage
  • ulp, the units in the last place, used to define the precision of comparisons.
  • C, the checker type, used to inject methods that verify consistency; the library provides two standard checkers: EmptyChecker (for the log_*_t types above) and ProbabilityChecker (for the probability_*_t types above).

By default, all aliases above have ulp = 0 (meaning that the precision equals the machine epsilon of the value type).