OpenGM  2.3.x
Discrete Graphical Model Library
Public Types | Public Member Functions | Static Public Attributes | List of all members
opengm::PottsGFunction< T, I, L > Class Template Reference

Generalized Potts Function. More...

#include <pottsg.hxx>

+ Inheritance diagram for opengm::PottsGFunction< T, I, L >:
+ Collaboration diagram for opengm::PottsGFunction< T, I, L >:

Public Types

typedef T ValueType
 
typedef I IndexType
 
typedef L LabelType
 
- Public Types inherited from opengm::FunctionBase< PottsGFunction< T, I, L >, T, I, L >
typedef AccessorIterator< FunctionShapeAccessorType, true > FunctionShapeIteratorType
 

Public Member Functions

 PottsGFunction ()
 
template<class ITERATOR >
 PottsGFunction (ITERATOR, ITERATOR)
 
template<class ITERATOR , class ITERATOR2 >
 PottsGFunction (ITERATOR, ITERATOR, ITERATOR2)
 
LabelType shape (const size_t) const
 
size_t size () const
 
size_t dimension () const
 
template<class ITERATOR >
ValueType operator() (ITERATOR) const
 
bool isPotts () const
 
bool isGeneralizedPotts () const
 
template<class LABELITERATOR >
void setByLabel (LABELITERATOR, T)
 
void setByPartition (size_t, T)
 
template<class ITERATOR >
operator() (ITERATOR begin) const
 
- Public Member Functions inherited from opengm::FunctionBase< PottsGFunction< T, I, L >, T, I, L >
bool isPotts () const
 
bool isGeneralizedPotts () const
 
bool isSubmodular () const
 
bool isSquaredDifference () const
 
bool isTruncatedSquaredDifference () const
 
bool isAbsoluteDifference () const
 
bool isTruncatedAbsoluteDifference () const
 
bool isLinearConstraint () const
 
MinMaxFunctor< T > minMax () const
 find minimum and maximum of the function in a single sweep More...
 
ReturnType min () const
 
ReturnType max () const
 
ReturnType sum () const
 
ReturnType product () const
 
ReturnType accumulate () const
 accumulate all values of the function More...
 
void forAllValuesInOrder (FUNCTOR &functor) const
 call a functor for each value of the function (in lexicographical order of the variable indices) More...
 
void forAllValuesInSwitchedOrder (FUNCTOR &functor) const
 
void forAllValuesInAnyOrder (FUNCTOR &functor) const
 call a functor for each value of the function (in un-specified order) More...
 
void forAtLeastAllUniqueValues (FUNCTOR &functor) const
 call a functor for at least all unique values of the function More...
 
void forAllValuesInOrderWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
void forAllValuesInAnyOrderWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
void forAtLeastAllUniqueValuesWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
bool operator== (const PottsGFunction< T, I, L > &) const
 
FunctionShapeIteratorType functionShapeBegin () const
 
FunctionShapeIteratorType functionShapeEnd () const
 
size_t numberOfParameters () const
 
parameterIndex (const size_t paramNumber) const
 

Static Public Attributes

static const size_t BellNumbers_ [16] = {1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, 115975, 678570, 4213597, 27644437, 190899322, 1382958545}
 
static const size_t MaximalOrder_ = 11
 

Detailed Description

template<class T, class I = size_t, class L = size_t>
class opengm::PottsGFunction< T, I, L >

Generalized Potts Function.

A generalized Potts function is a function that is invariant under all permutations of labels, e.g. f(1, 1, 3, 4) = f(3, 3, 4, 1).

Its purpose is to assign different values to different partitions of the set of input variables, regardless of which labels are used to describe this partition.

It generalizes the Potts function that distinguishes only between equal and unequal labels.

The memory required to store a generalized Potts function depends only on the order of the function, not on the number of labels. Due to the trasitivity of the equality relation, the number of all partitions of a set of D elements is smaller than 2^(D*(D+1)/2). The exact number is given by the Bell numbers B_D, e.g. B_1=1, B_2=2, B_3=5, B_4=15, B_5=52, B_6=203

Definition at line 36 of file pottsg.hxx.

Member Typedef Documentation

template<class T, class I = size_t, class L = size_t>
typedef I opengm::PottsGFunction< T, I, L >::IndexType

Definition at line 41 of file pottsg.hxx.

template<class T, class I = size_t, class L = size_t>
typedef L opengm::PottsGFunction< T, I, L >::LabelType

Definition at line 42 of file pottsg.hxx.

template<class T, class I = size_t, class L = size_t>
typedef T opengm::PottsGFunction< T, I, L >::ValueType

Definition at line 40 of file pottsg.hxx.

Constructor & Destructor Documentation

template<class T , class I , class L >
opengm::PottsGFunction< T, I, L >::PottsGFunction ( )
inline

Definition at line 146 of file pottsg.hxx.

template<class T , class I , class L >
template<class ITERATOR >
opengm::PottsGFunction< T, I, L >::PottsGFunction ( ITERATOR  shapeBegin,
ITERATOR  shapeEnd 
)
inline

Definition at line 99 of file pottsg.hxx.

template<class T , class I , class L >
template<class ITERATOR , class ITERATOR2 >
opengm::PottsGFunction< T, I, L >::PottsGFunction ( ITERATOR  shapeBegin,
ITERATOR  shapeEnd,
ITERATOR2  valuesBegin 
)
inline

Definition at line 121 of file pottsg.hxx.

Member Function Documentation

template<class T , class I , class L >
size_t opengm::PottsGFunction< T, I, L >::dimension ( ) const
inline

Definition at line 273 of file pottsg.hxx.

template<class T , class I , class L >
bool opengm::PottsGFunction< T, I, L >::isGeneralizedPotts ( ) const
inline

Definition at line 296 of file pottsg.hxx.

template<class T , class I , class L >
bool opengm::PottsGFunction< T, I, L >::isPotts ( ) const
inline

Definition at line 286 of file pottsg.hxx.

template<class T, class I = size_t, class L = size_t>
template<class ITERATOR >
ValueType opengm::PottsGFunction< T, I, L >::operator() ( ITERATOR  ) const
template<class T, class I = size_t, class L = size_t>
template<class ITERATOR >
T opengm::PottsGFunction< T, I, L >::operator() ( ITERATOR  begin) const
inline

Definition at line 154 of file pottsg.hxx.

template<class T, class I , class L >
template<class LABELITERATOR >
void opengm::PottsGFunction< T, I, L >::setByLabel ( LABELITERATOR  it,
value 
)

Definition at line 209 of file pottsg.hxx.

template<class T, class I , class L >
void opengm::PottsGFunction< T, I, L >::setByPartition ( size_t  partition,
value 
)

Definition at line 229 of file pottsg.hxx.

template<class T , class I , class L >
PottsGFunction< T, I, L >::LabelType opengm::PottsGFunction< T, I, L >::shape ( const size_t  i) const
inline

Definition at line 263 of file pottsg.hxx.

template<class T , class I , class L >
size_t opengm::PottsGFunction< T, I, L >::size ( ) const
inline

Definition at line 280 of file pottsg.hxx.

Member Data Documentation

template<class T, class I = size_t, class L = size_t>
const size_t opengm::PottsGFunction< T, I, L >::BellNumbers_ = {1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, 115975, 678570, 4213597, 27644437, 190899322, 1382958545}
static

Definition at line 56 of file pottsg.hxx.

template<class T, class I = size_t, class L = size_t>
const size_t opengm::PottsGFunction< T, I, L >::MaximalOrder_ = 11
static

Definition at line 57 of file pottsg.hxx.