libDAI
Public Types | Public Member Functions | Private Attributes | Related Functions | List of all members
dai::TProbSp< T, spvector_type > Class Template Reference

Represents a vector with entries of type T. More...

#include <dai/probsp.h>

Public Types

typedef spvector_type container_type
 Type of data structure used for storing the values.
typedef TProbSp< T, spvector_type > this_type
typedef
container_type::const_iterator 
const_iterator
 Constant iterator over the elements.
typedef container_type::iterator iterator
 Iterator over the elements.
typedef
container_type::const_reverse_iterator 
const_reverse_iterator
 Constant reverse iterator over the elements.
typedef
container_type::reverse_iterator 
reverse_iterator
 Reverse iterator over the elements.

Public Member Functions

template<typename binOp1 , typename binOp2 >
innerProduct (const this_type &q, T init, binOp1 binaryOp1, binOp2 binaryOp2) const
 Performs a generalized inner product, similar to std::inner_product.
Constructors and destructors
 TProbSp ()
 Default constructor (constructs empty vector)
 TProbSp (size_t n)
 Construct uniform probability distribution over n outcomes (i.e., a vector of length n with each entry set to $1/n$)
 TProbSp (size_t n, T p)
 Construct vector of length n with each entry set to p.
template<typename TIterator >
 TProbSp (TIterator begin, TIterator end, size_t sizeHint, T def=0)
 Construct sparse vector from a range.
template<typename S >
 TProbSp (const std::vector< S > &v, T def=0)
 Construct vector from another vector.
Iterator interface
iterator begin ()
 Returns iterator that points to the first nondefault element.
const_iterator begin () const
 Returns constant iterator that points to the first nondefault element.
iterator end ()
 Returns iterator that points beyond the last nondefault element.
const_iterator end () const
 Returns constant iterator that points beyond the last nondefault element.
reverse_iterator rbegin ()
 Returns reverse iterator that points to the last nondefault element.
const_reverse_iterator rbegin () const
 Returns constant reverse iterator that points to the last nondefault element.
reverse_iterator rend ()
 Returns reverse iterator that points beyond the first nondefault element.
const_reverse_iterator rend () const
 Returns constant reverse iterator that points beyond the first nondefault element.
Miscellaneous operations
void resize (size_t sz)
Get/set individual entries
get (size_t i) const
 Gets i 'th entry.
void set (size_t i, T val)
 Sets i 'th entry to val.
Queries
const container_typep () const
 Returns a const reference to the wrapped container.
container_typep ()
 Returns a reference to the wrapped container.
operator[] (size_t i) const
 Returns a copy of the i 'th entry.
size_t size () const
 Returns length of the vector (i.e., the number of entries)
size_t nrDef () const
 Returns number of default values.
size_t nrNonDef () const
 Returns number of nondefault values.
def () const
 Returns default value.
void setDef (T def)
 Sets default value.
template<typename unOp >
accumulateSum (T init, unOp op) const
 Accumulate all values (similar to std::accumulate) by summing.
template<typename unOp >
accumulateMax (T init, unOp op, bool minimize) const
 Accumulate all values (similar to std::accumulate) by maximization/minimization.
entropy () const
 Returns the Shannon entropy of *this, $-\sum_i p_i \log p_i$.
max () const
 Returns maximum value of all entries.
min () const
 Returns minimum value of all entries.
sum () const
 Returns sum of all entries.
sumAbs () const
 Return sum of absolute value of all entries.
maxAbs () const
 Returns maximum absolute value of all entries.
bool hasNaNs () const
 Returns true if one or more entries are NaN.
bool hasNegatives () const
 Returns true if one or more entries are negative.
std::pair< size_t, T > argmax () const
 Returns a pair consisting of the index of the maximum value and the maximum value itself.
size_t draw ()
 Returns a random index, according to the (normalized) distribution described by *this.
bool operator< (const this_type &q) const
 Lexicographical comparison.
bool operator== (const this_type &q) const
 Comparison.
Unary transformations
template<typename unaryOp >
this_type pwUnaryTr (unaryOp op) const
 Returns the result of applying operation op pointwise on *this.
this_type operator- () const
 Returns negative of *this.
this_type abs () const
 Returns pointwise absolute value.
this_type exp () const
 Returns pointwise exponent.
this_type log (bool zero=false) const
 Returns pointwise logarithm.
this_type inverse (bool zero=true) const
 Returns pointwise inverse.
this_type normalized (ProbNormType norm=dai::NORMPROB) const
 Returns normalized copy of *this, using the specified norm.
Unary operations
template<typename unaryOp >
this_typepwUnaryOp (unaryOp op)
 Applies unary operation op pointwise.
this_typerandomize ()
 Draws all entries i.i.d. from a uniform distribution on [0,1)
this_typesetUniform ()
 Sets all entries to $1/n$ where n is the length of the vector.
this_typetakeAbs ()
 Applies absolute value pointwise.
this_typetakeExp ()
 Applies exponent pointwise.
this_typetakeLog (bool zero=false)
 Applies logarithm pointwise.
normalize (ProbNormType norm=dai::NORMPROB)
 Normalizes vector using the specified norm.
Operations with scalars
this_typefill (T x)
 Sets all entries to x.
this_typeoperator+= (T x)
 Adds scalar x to each entry.
this_typeoperator-= (T x)
 Subtracts scalar x from each entry.
this_typeoperator*= (T x)
 Multiplies each entry with scalar x.
this_typeoperator/= (T x)
 Divides each entry by scalar x, where division by 0 yields 0.
this_typeoperator^= (T x)
 Raises entries to the power x.
Transformations with scalars
this_type operator+ (T x) const
 Returns sum of *this and scalar x.
this_type operator- (T x) const
 Returns difference of *this and scalar x.
this_type operator* (T x) const
 Returns product of *this with scalar x.
this_type operator/ (T x) const
 Returns quotient of *this and scalar x, where division by 0 yields 0.
this_type operator^ (T x) const
 Returns *this raised to the power x.
Operations with other equally-sized vectors
template<typename binaryOp >
this_typepwBinaryOp (const this_type &q, binaryOp op)
 Applies binary operation pointwise on two vectors.
this_typeoperator+= (const this_type &q)
 Pointwise addition with q.
this_typeoperator-= (const this_type &q)
 Pointwise subtraction of q.
this_typeoperator*= (const this_type &q)
 Pointwise multiplication with q.
this_typeoperator/= (const this_type &q)
 Pointwise division by q, where division by 0 yields 0.
this_typedivide (const this_type &q)
 Pointwise division by q, where division by 0 yields +Inf.
this_typeoperator^= (const this_type &q)
 Pointwise power.
Transformations with other equally-sized vectors
template<typename binaryOp >
this_type pwBinaryTr (const this_type &q, binaryOp op) const
 Returns the result of applying binary operation op pointwise on *this and q.
this_type operator+ (const this_type &q) const
 Returns sum of *this and q.
this_type operator- (const this_type &q) const
 Return *this minus q.
this_type operator* (const this_type &q) const
 Return product of *this with q.
this_type operator/ (const this_type &q) const
 Returns quotient of *this with q, where division by 0 yields 0.
this_type divided_by (const this_type &q) const
 Pointwise division by q, where division by 0 yields +Inf.
this_type operator^ (const this_type &q) const
 Returns *this to the power q.

Private Attributes

container_type _p
 The data structure that stores the nondefault values.

Related Functions

(Note that these are not member functions.)

template<typename T , typename spvector_type >
dist (const TProbSp< T, spvector_type > &p, const TProbSp< T, spvector_type > &q, ProbDistType dt)
 Returns distance between p and q, measured using distance measure dt.
template<typename T , typename spvector_type >
std::ostream & operator<< (std::ostream &os, const TProbSp< T, spvector_type > &p)
 Writes a TProbSp to an output stream.
template<typename T , typename spvector_type >
TProbSp< T, spvector_type > min (const TProbSp< T, spvector_type > &a, const TProbSp< T, spvector_type > &b)
 Returns the pointwise minimum of a and b.
template<typename T , typename spvector_type >
TProbSp< T, spvector_type > max (const TProbSp< T, spvector_type > &a, const TProbSp< T, spvector_type > &b)
 Returns the pointwise maximum of a and b.

Detailed Description

template<typename T, typename spvector_type>
class dai::TProbSp< T, spvector_type >

Represents a vector with entries of type T.

It is simply a std::vector<T> with an interface designed for dealing with probability mass functions.

It is mainly used for representing measures on a finite outcome space, for example, the probability distribution of a discrete random variable. However, entries are not necessarily non-negative; it is also used to represent logarithms of probability mass functions.

Template Parameters
TShould be a scalar that is castable from and to dai::Real and should support elementary arithmetic operations.

Member Typedef Documentation

template<typename T, typename spvector_type>
typedef spvector_type dai::TProbSp< T, spvector_type >::container_type

Type of data structure used for storing the values.

template<typename T, typename spvector_type>
typedef container_type::const_iterator dai::TProbSp< T, spvector_type >::const_iterator

Constant iterator over the elements.

template<typename T, typename spvector_type>
typedef container_type::iterator dai::TProbSp< T, spvector_type >::iterator

Iterator over the elements.

template<typename T, typename spvector_type>
typedef container_type::const_reverse_iterator dai::TProbSp< T, spvector_type >::const_reverse_iterator

Constant reverse iterator over the elements.

template<typename T, typename spvector_type>
typedef container_type::reverse_iterator dai::TProbSp< T, spvector_type >::reverse_iterator

Reverse iterator over the elements.

Constructor & Destructor Documentation

template<typename T, typename spvector_type>
dai::TProbSp< T, spvector_type >::TProbSp ( )
inline

Default constructor (constructs empty vector)

template<typename T, typename spvector_type>
dai::TProbSp< T, spvector_type >::TProbSp ( size_t  n)
inlineexplicit

Construct uniform probability distribution over n outcomes (i.e., a vector of length n with each entry set to $1/n$)

template<typename T, typename spvector_type>
dai::TProbSp< T, spvector_type >::TProbSp ( size_t  n,
p 
)
inlineexplicit

Construct vector of length n with each entry set to p.

template<typename T, typename spvector_type>
template<typename TIterator >
dai::TProbSp< T, spvector_type >::TProbSp ( TIterator  begin,
TIterator  end,
size_t  sizeHint,
def = 0 
)
inline

Construct sparse vector from a range.

Template Parameters
TIteratorIterates over instances that can be cast to T
Parameters
beginPoints to first instance to be added.
endPoints just beyond last instance to be added.
sizeHintFor efficiency, the number of entries can be speficied by sizeHint; the value 0 can be given if the size is unknown, but this will result in a performance penalty.
defDefault value to use for the constructed sparse vector.
template<typename T, typename spvector_type>
template<typename S >
dai::TProbSp< T, spvector_type >::TProbSp ( const std::vector< S > &  v,
def = 0 
)
inline

Construct vector from another vector.

Template Parameters
Stype of elements in v (should be castable to type T)
Parameters
vvector used for initialization.
defDefault value to used for the constructed sparse vector.

Member Function Documentation

template<typename T, typename spvector_type>
iterator dai::TProbSp< T, spvector_type >::begin ( )
inline

Returns iterator that points to the first nondefault element.

template<typename T, typename spvector_type>
const_iterator dai::TProbSp< T, spvector_type >::begin ( ) const
inline

Returns constant iterator that points to the first nondefault element.

template<typename T, typename spvector_type>
iterator dai::TProbSp< T, spvector_type >::end ( )
inline

Returns iterator that points beyond the last nondefault element.

template<typename T, typename spvector_type>
const_iterator dai::TProbSp< T, spvector_type >::end ( ) const
inline

Returns constant iterator that points beyond the last nondefault element.

template<typename T, typename spvector_type>
reverse_iterator dai::TProbSp< T, spvector_type >::rbegin ( )
inline

Returns reverse iterator that points to the last nondefault element.

template<typename T, typename spvector_type>
const_reverse_iterator dai::TProbSp< T, spvector_type >::rbegin ( ) const
inline

Returns constant reverse iterator that points to the last nondefault element.

template<typename T, typename spvector_type>
reverse_iterator dai::TProbSp< T, spvector_type >::rend ( )
inline

Returns reverse iterator that points beyond the first nondefault element.

template<typename T, typename spvector_type>
const_reverse_iterator dai::TProbSp< T, spvector_type >::rend ( ) const
inline

Returns constant reverse iterator that points beyond the first nondefault element.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::get ( size_t  i) const
inline

Gets i 'th entry.

template<typename T, typename spvector_type>
void dai::TProbSp< T, spvector_type >::set ( size_t  i,
val 
)
inline

Sets i 'th entry to val.

template<typename T, typename spvector_type>
const container_type& dai::TProbSp< T, spvector_type >::p ( ) const
inline

Returns a const reference to the wrapped container.

template<typename T, typename spvector_type>
container_type& dai::TProbSp< T, spvector_type >::p ( )
inline

Returns a reference to the wrapped container.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::operator[] ( size_t  i) const
inline

Returns a copy of the i 'th entry.

template<typename T, typename spvector_type>
size_t dai::TProbSp< T, spvector_type >::size ( ) const
inline

Returns length of the vector (i.e., the number of entries)

template<typename T, typename spvector_type>
size_t dai::TProbSp< T, spvector_type >::nrDef ( ) const
inline

Returns number of default values.

template<typename T, typename spvector_type>
size_t dai::TProbSp< T, spvector_type >::nrNonDef ( ) const
inline

Returns number of nondefault values.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::def ( ) const
inline

Returns default value.

template<typename T, typename spvector_type>
void dai::TProbSp< T, spvector_type >::setDef ( def)
inline

Sets default value.

template<typename T, typename spvector_type>
template<typename unOp >
T dai::TProbSp< T, spvector_type >::accumulateSum ( init,
unOp  op 
) const
inline

Accumulate all values (similar to std::accumulate) by summing.

The following calculation is done:

T t = op(init);
for( const_iterator it = begin(); it != end(); it++ )
t += op(*it);
return t;
template<typename T, typename spvector_type>
template<typename unOp >
T dai::TProbSp< T, spvector_type >::accumulateMax ( init,
unOp  op,
bool  minimize 
) const
inline

Accumulate all values (similar to std::accumulate) by maximization/minimization.

The following calculation is done (with "max" replaced by "min" if minimize == true):

T t = op(init);
for( const_iterator it = begin(); it != end(); it++ )
t = std::max( t, op(*it) );
return t;
template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::entropy ( ) const
inline

Returns the Shannon entropy of *this, $-\sum_i p_i \log p_i$.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::max ( ) const
inline

Returns maximum value of all entries.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::min ( ) const
inline

Returns minimum value of all entries.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::sum ( ) const
inline

Returns sum of all entries.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::sumAbs ( ) const
inline

Return sum of absolute value of all entries.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::maxAbs ( ) const
inline

Returns maximum absolute value of all entries.

template<typename T, typename spvector_type>
bool dai::TProbSp< T, spvector_type >::hasNaNs ( ) const
inline

Returns true if one or more entries are NaN.

template<typename T, typename spvector_type>
bool dai::TProbSp< T, spvector_type >::hasNegatives ( ) const
inline

Returns true if one or more entries are negative.

template<typename T, typename spvector_type>
std::pair<size_t,T> dai::TProbSp< T, spvector_type >::argmax ( ) const
inline

Returns a pair consisting of the index of the maximum value and the maximum value itself.

template<typename T, typename spvector_type>
size_t dai::TProbSp< T, spvector_type >::draw ( )
inline

Returns a random index, according to the (normalized) distribution described by *this.

template<typename T, typename spvector_type>
bool dai::TProbSp< T, spvector_type >::operator< ( const this_type q) const
inline

Lexicographical comparison.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
bool dai::TProbSp< T, spvector_type >::operator== ( const this_type q) const
inline

Comparison.

template<typename T, typename spvector_type>
template<typename unaryOp >
this_type dai::TProbSp< T, spvector_type >::pwUnaryTr ( unaryOp  op) const
inline

Returns the result of applying operation op pointwise on *this.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator- ( ) const
inline

Returns negative of *this.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::abs ( ) const
inline

Returns pointwise absolute value.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::exp ( ) const
inline

Returns pointwise exponent.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::log ( bool  zero = false) const
inline

Returns pointwise logarithm.

If zero == true, uses log(0)==0; otherwise, log(0)==-Inf.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::inverse ( bool  zero = true) const
inline

Returns pointwise inverse.

If zero == true, uses 1/0==0; otherwise, 1/0==Inf.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::normalized ( ProbNormType  norm = dai::NORMPROB) const
inline

Returns normalized copy of *this, using the specified norm.

Exceptions
NOT_NORMALIZABLEif the norm is zero
template<typename T, typename spvector_type>
template<typename unaryOp >
this_type& dai::TProbSp< T, spvector_type >::pwUnaryOp ( unaryOp  op)
inline

Applies unary operation op pointwise.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::randomize ( )
inline

Draws all entries i.i.d. from a uniform distribution on [0,1)

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::setUniform ( )
inline

Sets all entries to $1/n$ where n is the length of the vector.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::takeAbs ( )
inline

Applies absolute value pointwise.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::takeExp ( )
inline

Applies exponent pointwise.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::takeLog ( bool  zero = false)
inline

Applies logarithm pointwise.

If zero == true, uses log(0)==0; otherwise, log(0)==-Inf.

template<typename T, typename spvector_type>
T dai::TProbSp< T, spvector_type >::normalize ( ProbNormType  norm = dai::NORMPROB)
inline

Normalizes vector using the specified norm.

Exceptions
NOT_NORMALIZABLEif the norm is zero
template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::fill ( x)
inline

Sets all entries to x.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator+= ( x)
inline

Adds scalar x to each entry.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator-= ( x)
inline

Subtracts scalar x from each entry.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator*= ( x)
inline

Multiplies each entry with scalar x.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator/= ( x)
inline

Divides each entry by scalar x, where division by 0 yields 0.

template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator^= ( x)
inline

Raises entries to the power x.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator+ ( x) const
inline

Returns sum of *this and scalar x.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator- ( x) const
inline

Returns difference of *this and scalar x.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator* ( x) const
inline

Returns product of *this with scalar x.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator/ ( x) const
inline

Returns quotient of *this and scalar x, where division by 0 yields 0.

template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator^ ( x) const
inline

Returns *this raised to the power x.

template<typename T, typename spvector_type>
template<typename binaryOp >
this_type& dai::TProbSp< T, spvector_type >::pwBinaryOp ( const this_type q,
binaryOp  op 
)
inline

Applies binary operation pointwise on two vectors.

Template Parameters
binaryOpType of function object that accepts two arguments of type T and outputs a type T
Parameters
qRight operand
opOperation of type binaryOp
template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator+= ( const this_type q)
inline

Pointwise addition with q.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator-= ( const this_type q)
inline

Pointwise subtraction of q.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator*= ( const this_type q)
inline

Pointwise multiplication with q.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator/= ( const this_type q)
inline

Pointwise division by q, where division by 0 yields 0.

Precondition
this->size() == q.size()
See Also
divide(const this_type &)
template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::divide ( const this_type q)
inline

Pointwise division by q, where division by 0 yields +Inf.

Precondition
this->size() == q.size()
See Also
operator/=(const this_type &)
template<typename T, typename spvector_type>
this_type& dai::TProbSp< T, spvector_type >::operator^= ( const this_type q)
inline

Pointwise power.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
template<typename binaryOp >
this_type dai::TProbSp< T, spvector_type >::pwBinaryTr ( const this_type q,
binaryOp  op 
) const
inline

Returns the result of applying binary operation op pointwise on *this and q.

Template Parameters
binaryOpType of function object that accepts two arguments of type T and outputs a type T
Parameters
qRight operand
opOperation of type binaryOp
template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator+ ( const this_type q) const
inline

Returns sum of *this and q.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator- ( const this_type q) const
inline

Return *this minus q.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator* ( const this_type q) const
inline

Return product of *this with q.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator/ ( const this_type q) const
inline

Returns quotient of *this with q, where division by 0 yields 0.

Precondition
this->size() == q.size()
See Also
divided_by(const this_type &)
template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::divided_by ( const this_type q) const
inline

Pointwise division by q, where division by 0 yields +Inf.

Precondition
this->size() == q.size()
See Also
operator/(const this_type &)
template<typename T, typename spvector_type>
this_type dai::TProbSp< T, spvector_type >::operator^ ( const this_type q) const
inline

Returns *this to the power q.

Precondition
this->size() == q.size()
template<typename T, typename spvector_type>
template<typename binOp1 , typename binOp2 >
T dai::TProbSp< T, spvector_type >::innerProduct ( const this_type q,
init,
binOp1  binaryOp1,
binOp2  binaryOp2 
) const
inline

Performs a generalized inner product, similar to std::inner_product.

Precondition
this->size() == q.size()

Friends And Related Function Documentation

template<typename T , typename spvector_type >
T dist ( const TProbSp< T, spvector_type > &  p,
const TProbSp< T, spvector_type > &  q,
ProbDistType  dt 
)
related

Returns distance between p and q, measured using distance measure dt.

Precondition
this->size() == q.size()
template<typename T , typename spvector_type >
std::ostream & operator<< ( std::ostream &  os,
const TProbSp< T, spvector_type > &  p 
)
related

Writes a TProbSp to an output stream.

template<typename T , typename spvector_type >
TProbSp< T, spvector_type > min ( const TProbSp< T, spvector_type > &  a,
const TProbSp< T, spvector_type > &  b 
)
related

Returns the pointwise minimum of a and b.

Precondition
this->size() == q.size()
template<typename T , typename spvector_type >
TProbSp< T, spvector_type > max ( const TProbSp< T, spvector_type > &  a,
const TProbSp< T, spvector_type > &  b 
)
related

Returns the pointwise maximum of a and b.

Precondition
this->size() == q.size()

Member Data Documentation

template<typename T, typename spvector_type>
container_type dai::TProbSp< T, spvector_type >::_p
private

The data structure that stores the nondefault values.


The documentation for this class was generated from the following file: