#include <likelihoods.hpp>
Public Types | |
| typedef Domain | domain_type |
| Type of domain of operations. | |
| typedef Value | value_type |
| Type representing likelihood values. | |
| typedef Validator | validator_type |
| Type modeling ValidatorConcept for likelihood values. | |
Public Member Functions | |
| likelihood () | |
| Construct a likelihood of unity. | |
| template<typename T> | |
| likelihood (const T &t) | |
| Explicitly construct a likelihood. | |
| template<typename T, typename D> | |
| likelihood (const T &t, D) | |
| Explicitly construct a likelihood from another domain. | |
| template<typename D, typename V, typename VV> | |
| likelihood (const likelihood< D, V, VV > &l) | |
| Transform a likelihood from another domain. | |
| template<typename D, typename V, typename VV> | |
| likelihood (const probability< D, V, VV > &l) | |
| Construct a likelihood from a probability. | |
| likelihood (const likelihood &l) | |
| likelihood & | operator= (const likelihood &l) |
| void | swap (likelihood &l) |
| likelihood | operator+ () const |
| Unary plus operator. | |
| template<typename D> | |
| likelihood< D, value_type, validator_type > | domain_cast (D) const |
| Cast to another domain. | |
| template<typename D> | |
| value_type | value_cast (D) const |
| Cast the internal value to another domain. | |
Mathematical assignment operators | |
The likelihood class is derived from the boost::operators classes. As a result, these mathematical assignment operators are the foundation for a complete set of natural mathematical operations. The likelihood class supports the full range of arithmetic operators. | |
| template<typename D, typename V, typename VV> | |
| likelihood & | operator+= (const likelihood< D, V, VV > &l) |
| Addition assignment operator. | |
| template<typename T> | |
| likelihood & | operator+= (const T &t) |
| Addition assignment operator. | |
| template<typename D, typename V, typename VV> | |
| likelihood & | operator+= (const probability< D, V, VV > &p) |
| Addition assignment operator. | |
| template<typename D, typename V, typename VV> | |
| likelihood & | operator-= (const likelihood< D, V, VV > &l) |
| Subtraction assignment operator. | |
| template<typename T> | |
| likelihood & | operator-= (const T &t) |
| Subtraction assignment operator. | |
| template<typename D, typename V, typename VV> | |
| likelihood & | operator-= (const probability< D, V, VV > &p) |
| Subtraction assignment operator. | |
| template<typename D, typename V, typename VV> | |
| likelihood & | operator *= (const likelihood< D, V, VV > &l) |
| Multiplication assignment operator. | |
| template<typename T> | |
| likelihood & | operator *= (const T &t) |
| Multiplication assignment operator. | |
| template<typename D, typename V, typename VV> | |
| likelihood & | operator *= (const probability< D, V, VV > &p) |
| Multiplication assignment operator. | |
| template<typename D, typename V, typename VV> | |
| likelihood & | operator/= (const likelihood< D, V, VV > &l) |
| Division assignment operator. | |
| template<typename T> | |
| likelihood & | operator/= (const T &t) |
| Division assignment operator. | |
| template<typename D, typename V, typename VV> | |
| likelihood & | operator/= (const probability< D, V, VV > &p) |
| Division assignment operator. | |
This class encapsulates a likelihood quantity, represented as the value_type template argument. Likelihoods and their logarithms are encapsulated by types differing in their domains (i.e., the linear_domain versus the log_domain). In both cases, however, the same semantics apply to the same operators. For example, the multiplication operator operator*() denotes multiplication of likelihoods or addition of logarithms of likelihoods. This helps make the fundamental operations clearer in the code while providing an explicit means of selecting the mode of operation, for example to avoid underflow of the value_type. The consistency of semantics also makes generic algorithms possible.
In addition to providing all the natural arithmetic operators, the likelihood class models the following concepts.
value_type must also model most of these. In addition, the value_type must provide the exponential functions exp(), log(), and log1p(). Finally, the class provides strong exception guarrantees. For example, although an assignment may throw an exception, it will do so only if the copy constructor does. If this occurs, the original lvalue object is guarranteed to be unchanged.
|
|||||
|
Type of domain of operations. The domain of operations is assumed to be one of linear_domain or log_domain. |
|
|||||
|
Type representing likelihood values.
The value type should be a model of the real numbers within the semi-open interval |
|
|||||||||
|
Construct a likelihood of unity. In many contexts, the most common operation on likelihoods is multiplication. To simplify the accumulation of a product of likelihoods, the default constructed value is the multiplicative identity. |
|
||||||||||||||
|
Explicitly construct a likelihood.
value_type). |
|
||||||||||||||||||||
|
Explicitly construct a likelihood from another domain.
value_type). |
|
||||||||||||||
|
Multiplication assignment operator.
Multiply a likelihood by a value of type T. Note that type T must be convertible to the |
|
||||||||||||||
|
Addition assignment operator.
Add a value of type T to a likelihood. Note that type T must be convertible to the |
|
||||||||||||||
|
Subtraction assignment operator.
Subtract a value of type T from a likelihood. Note that type T must be convertible to the |
|
||||||||||||||
|
Division assignment operator.
Divide a likelihood by a value of type T. Note that type T must be convertible to the |
1.4.5