boost::probabilities::likelihood< Domain, Value, Validator > Class Template Reference

Likelihood quantity. More...

#include <likelihoods.hpp>

List of all members.

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)
likelihoodoperator= (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>
likelihoodoperator+= (const likelihood< D, V, VV > &l)
 Addition assignment operator.
template<typename T>
likelihoodoperator+= (const T &t)
 Addition assignment operator.
template<typename D, typename V, typename VV>
likelihoodoperator+= (const probability< D, V, VV > &p)
 Addition assignment operator.
template<typename D, typename V, typename VV>
likelihoodoperator-= (const likelihood< D, V, VV > &l)
 Subtraction assignment operator.
template<typename T>
likelihoodoperator-= (const T &t)
 Subtraction assignment operator.
template<typename D, typename V, typename VV>
likelihoodoperator-= (const probability< D, V, VV > &p)
 Subtraction assignment operator.
template<typename D, typename V, typename VV>
likelihoodoperator *= (const likelihood< D, V, VV > &l)
 Multiplication assignment operator.
template<typename T>
likelihoodoperator *= (const T &t)
 Multiplication assignment operator.
template<typename D, typename V, typename VV>
likelihoodoperator *= (const probability< D, V, VV > &p)
 Multiplication assignment operator.
template<typename D, typename V, typename VV>
likelihoodoperator/= (const likelihood< D, V, VV > &l)
 Division assignment operator.
template<typename T>
likelihoodoperator/= (const T &t)
 Division assignment operator.
template<typename D, typename V, typename VV>
likelihoodoperator/= (const probability< D, V, VV > &p)
 Division assignment operator.


Detailed Description

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
class boost::probabilities::likelihood< Domain, Value, Validator >

Likelihood quantity.

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.

In order to model these concepts, however, the underlying 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.


Member Typedef Documentation

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
typedef Domain boost::probabilities::likelihood< Domain, Value, Validator >::domain_type
 

Type of domain of operations.

The domain of operations is assumed to be one of linear_domain or log_domain.

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
typedef Value boost::probabilities::likelihood< Domain, Value, Validator >::value_type
 

Type representing likelihood values.

The value type should be a model of the real numbers within the semi-open interval $[0,\infty)$ .


Constructor & Destructor Documentation

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
boost::probabilities::likelihood< Domain, Value, Validator >::likelihood  )  [inline]
 

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.

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
template<typename T>
boost::probabilities::likelihood< Domain, Value, Validator >::likelihood const T &  t  )  [inline, explicit]
 

Explicitly construct a likelihood.

Parameters:
t Value of likelihood represented as the type T.
Note that type T must be convertible to the internal representation of a probability (i.e., to the value_type).

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
template<typename T, typename D>
boost::probabilities::likelihood< Domain, Value, Validator >::likelihood const T &  t,
[inline]
 

Explicitly construct a likelihood from another domain.

Parameters:
t Value of likelihood represented as the type T.
Note that type T must be convertible to the internal representation of a probability (i.e., to the value_type).


Member Function Documentation

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
template<typename T>
likelihood& boost::probabilities::likelihood< Domain, Value, Validator >::operator *= const T &  t  )  [inline]
 

Multiplication assignment operator.

Multiply a likelihood by a value of type T. Note that type T must be convertible to the value_type. Furthermore, t is assumed to be in the linear domain; it will be converted to the appropriate domain as required.

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
template<typename T>
likelihood& boost::probabilities::likelihood< Domain, Value, Validator >::operator+= const T &  t  )  [inline]
 

Addition assignment operator.

Add a value of type T to a likelihood. Note that type T must be convertible to the value_type. Furthermore, t is assumed to be in the linear domain; it will be converted to the appropriate domain as required.

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
template<typename T>
likelihood& boost::probabilities::likelihood< Domain, Value, Validator >::operator-= const T &  t  )  [inline]
 

Subtraction assignment operator.

Subtract a value of type T from a likelihood. Note that type T must be convertible to the value_type. Furthermore, t is assumed to be in the linear domain; it will be converted to the appropriate domain as required.

template<typename Domain = linear_domain, typename Value = double, typename Validator = null_validator<Value>>
template<typename T>
likelihood& boost::probabilities::likelihood< Domain, Value, Validator >::operator/= const T &  t  )  [inline]
 

Division assignment operator.

Divide a likelihood by a value of type T. Note that type T must be convertible to the value_type. Furthermore, t is assumed to be in the linear domain; it will be converted to the appropriate domain as required.


The documentation for this class was generated from the following file:
Generated on Thu Oct 18 11:10:28 2007 for Boost.Probability: C++ Probability and Likelihood Library by  doxygen 1.4.5