opengm::Factor< GRAPHICAL_MODEL > Class Template Reference

Abstraction (wrapper class) of factors, independent of the function used to implement the factor. More...

#include <graphicalmodel_factor.hxx>

Collaboration diagram for opengm::Factor< GRAPHICAL_MODEL >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  FunctionInformation { NrOfFunctionTypes = GraphicalModelType::NrOfFunctionTypes }
typedef GRAPHICAL_MODEL * GraphicalModelPointerType
typedef GRAPHICAL_MODEL GraphicalModelType
typedef
GraphicalModelType::FunctionTypeList 
FunctionTypeList
typedef
GraphicalModelType::ValueType 
ValueType
typedef
GraphicalModelType::LabelType 
LabelType
typedef
GraphicalModelType::IndexType 
IndexType
typedef
opengm::AccessorIterator
< ShapeAccessorType, true > 
ShapeIteratorType
typedef std::vector< IndexType >
::const_iterator 
VariablesIteratorType

Public Member Functions

 Factor ()
 Factor (GraphicalModelPointerType)
 factors are usually not constructed directly but obtained from operator[] of GraphicalModel
 Factor (const Factor &)
template<class ITERATOR >
 Factor (GraphicalModelPointerType, const IndexType, const UInt8Type, ITERATOR, ITERATOR)
 factors are usually not constructed directly but obtained from operator[] of GraphicalModel
Factoroperator= (const Factor &)
IndexType size () const
IndexType numberOfVariables () const
IndexType numberOfLabels (const IndexType) const
 return the number of labels of the j-th variable
IndexType shape (const IndexType) const
 return the extension a value table encoding this factor would have in the dimension of the j-th variable
IndexType variableIndex (const IndexType) const
 return the index of the j-th variable
ShapeIteratorType shapeBegin () const
ShapeIteratorType shapeEnd () const
template<size_t FUNCTION_TYPE_INDEX>
const meta::TypeAtTypeList
< FunctionTypeList,
FUNCTION_TYPE_INDEX >::type & 
function () const
VariablesIteratorType variableIndicesBegin () const
VariablesIteratorType variableIndicesEnd () const
template<class ITERATOR >
ValueType operator() (ITERATOR) const
 evaluate the factor for a sequence of labels
template<class ITERATOR >
void copyValues (ITERATOR iterator) const
 copies the values of a factors into an iterator
template<class ITERATOR >
void copyValuesSwitchedOrder (ITERATOR iterator) const
template<int FunctionType, class ITERATOR >
ValueType operator() (ITERATOR) const
UInt8Type functionType () const
IndexType functionIndex () const
template<class ITERATOR >
void variableIndices (ITERATOR out) const
bool isPotts () const
bool isGeneralizedPotts () const
bool isSubmodular () const
bool isSquaredDifference () const
bool isTruncatedSquaredDifference () const
bool isAbsoluteDifference () const
bool isTruncatedAbsoluteDifference () const
template<int PROPERTY>
bool binaryProperty () const
 compute a binary property of a factor
template<int PROPERTY>
ValueType valueProperty () const
 compute a property of a factor
template<class FUNCTOR >
void forAllValuesInAnyOrder (FUNCTOR &functor) const
 call a functor for all values in no defined order
template<class FUNCTOR >
void forAtLeastAllUniqueValues (FUNCTOR &functor) const
 call a functor for at least all unique values in no defined order
template<class FUNCTOR >
void forAllValuesInOrder (FUNCTOR &functor) const
 call a functor for all values in last coordinate major order
template<class FUNCTOR >
void forAllValuesInSwitchedOrder (FUNCTOR &functor) const
ValueType sum () const
ValueType product () const
ValueType min () const
ValueType max () const

Friends

template<typename GM_ >
void opengm::hdf5::save (const GM_ &, const std::string &, const std::string &)
template<typename GM_ >
void opengm::hdf5::load (GM_ &, const std::string &, const std::string &)

Detailed Description

template<class GRAPHICAL_MODEL>
class opengm::Factor< GRAPHICAL_MODEL >

Abstraction (wrapper class) of factors, independent of the function used to implement the factor.

Definition at line 80 of file graphicalmodel_factor.hxx.


Member Typedef Documentation

template<class GRAPHICAL_MODEL>
typedef GraphicalModelType::FunctionTypeList opengm::Factor< GRAPHICAL_MODEL >::FunctionTypeList

Definition at line 88 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL>
typedef GRAPHICAL_MODEL* opengm::Factor< GRAPHICAL_MODEL >::GraphicalModelPointerType

Definition at line 82 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL>
typedef GRAPHICAL_MODEL opengm::Factor< GRAPHICAL_MODEL >::GraphicalModelType

Definition at line 83 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL>
typedef GraphicalModelType::IndexType opengm::Factor< GRAPHICAL_MODEL >::IndexType

Definition at line 91 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL>
typedef GraphicalModelType::LabelType opengm::Factor< GRAPHICAL_MODEL >::LabelType

Definition at line 90 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL>
typedef opengm::AccessorIterator<ShapeAccessorType, true> opengm::Factor< GRAPHICAL_MODEL >::ShapeIteratorType

Definition at line 95 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL>
typedef GraphicalModelType::ValueType opengm::Factor< GRAPHICAL_MODEL >::ValueType

Definition at line 89 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL>
typedef std::vector<IndexType>::const_iterator opengm::Factor< GRAPHICAL_MODEL >::VariablesIteratorType

Definition at line 96 of file graphicalmodel_factor.hxx.


Member Enumeration Documentation

template<class GRAPHICAL_MODEL>
enum opengm::Factor::FunctionInformation
Enumerator:
NrOfFunctionTypes 

Definition at line 84 of file graphicalmodel_factor.hxx.


Constructor & Destructor Documentation

template<class GRAPHICAL_MODEL>
opengm::Factor< GRAPHICAL_MODEL >::Factor (  ) 
template<class GRAPHICAL_MODEL >
opengm::Factor< GRAPHICAL_MODEL >::Factor ( GraphicalModelPointerType  gm  )  [inline]

factors are usually not constructed directly but obtained from operator[] of GraphicalModel

Definition at line 395 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
opengm::Factor< GRAPHICAL_MODEL >::Factor ( const Factor< GRAPHICAL_MODEL > &  src  )  [inline]

Definition at line 406 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<class ITERATOR >
opengm::Factor< GRAPHICAL_MODEL >::Factor ( GraphicalModelPointerType  gm,
const IndexType  functionIndex,
const UInt8Type  functionTypeId,
ITERATOR  begin,
ITERATOR  end 
) [inline]

factors are usually not constructed directly but obtained from operator[] of GraphicalModel

Definition at line 370 of file graphicalmodel_factor.hxx.


Member Function Documentation

template<class GRAPHICAL_MODEL >
template<int PROPERTY>
bool opengm::Factor< GRAPHICAL_MODEL >::binaryProperty (  )  const [inline]

compute a binary property of a factor

The property must be one of the properties defined in opengm::BinartyProperties::Values

Usage:

 const size_t factorIndex=0;
 bool isPotts=gm[factorIndex]. template binaryProperty<opengm::BinaryProperties::IsPotts>();
 OPENGM_ASSERT(gm[factorIndex].isPotts() == isPotts);

Definition at line 564 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<class ITERATOR >
void opengm::Factor< GRAPHICAL_MODEL >::copyValues ( ITERATOR  begin  )  const [inline]

copies the values of a factors into an iterator

Parameters:
begin output iterator to store the factors values in last coordinate major order

Definition at line 517 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<class ITERATOR >
void opengm::Factor< GRAPHICAL_MODEL >::copyValuesSwitchedOrder ( ITERATOR  iterator  )  const [inline]

Definition at line 529 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<class FUNCTOR >
void opengm::Factor< GRAPHICAL_MODEL >::forAllValuesInAnyOrder ( FUNCTOR &  functor  )  const [inline]

call a functor for all values in no defined order

Usage:

 opengm::AccumulationFunctor<opengm::Adder,ValueType> functor;
 const size_t factorIndex=0;
 gm[factorIndex].forAllValuesInAnyOrder(functor);
 OPENGM_ASSERT(gm[factorIndex].sum()==functor.value());

Definition at line 606 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<class FUNCTOR >
void opengm::Factor< GRAPHICAL_MODEL >::forAllValuesInOrder ( FUNCTOR &  functor  )  const [inline]

call a functor for all values in last coordinate major order

Usage:

 opengm::AccumulationFunctor<opengm::Multipler,ValueType> functor;
 const size_t factorIndex=0;
 gm[factorIndex].forAllValuesInOrder(functor);
 OPENGM_ASSERT(gm[factorIndex].product()==functor.value());

Definition at line 649 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<class FUNCTOR >
void opengm::Factor< GRAPHICAL_MODEL >::forAllValuesInSwitchedOrder ( FUNCTOR &  functor  )  const [inline]

Definition at line 661 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<class FUNCTOR >
void opengm::Factor< GRAPHICAL_MODEL >::forAtLeastAllUniqueValues ( FUNCTOR &  functor  )  const [inline]

call a functor for at least all unique values in no defined order

Usage:

 opengm::AccumulationFunctor<opengm::Maximizer,ValueType> functor;
 const size_t factorIndex=0;
 gm[factorIndex].forAtLeastAllUniqueValues(functor);
 OPENGM_ASSERT(gm[factorIndex].max()==functor.value());

Definition at line 628 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<size_t FUNCTION_TYPE_INDEX>
const meta::TypeAtTypeList< typename Factor< GRAPHICAL_MODEL >::FunctionTypeList, FUNCTION_TYPE_INDEX >::type & opengm::Factor< GRAPHICAL_MODEL >::function (  )  const [inline]

Definition at line 809 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::IndexType opengm::Factor< GRAPHICAL_MODEL >::functionIndex (  )  const [inline]

Definition at line 860 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
opengm::UInt8Type opengm::Factor< GRAPHICAL_MODEL >::functionType (  )  const [inline]

Definition at line 854 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
bool opengm::Factor< GRAPHICAL_MODEL >::isAbsoluteDifference (  )  const [inline]

Definition at line 726 of file graphicalmodel_factor.hxx.

Here is the call graph for this function:

template<class GRAPHICAL_MODEL >
bool opengm::Factor< GRAPHICAL_MODEL >::isGeneralizedPotts (  )  const [inline]

Definition at line 680 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
bool opengm::Factor< GRAPHICAL_MODEL >::isPotts (  )  const [inline]

Definition at line 671 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
bool opengm::Factor< GRAPHICAL_MODEL >::isSquaredDifference (  )  const [inline]

Definition at line 698 of file graphicalmodel_factor.hxx.

Here is the call graph for this function:

template<class GRAPHICAL_MODEL >
bool opengm::Factor< GRAPHICAL_MODEL >::isSubmodular (  )  const [inline]

Definition at line 689 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
bool opengm::Factor< GRAPHICAL_MODEL >::isTruncatedAbsoluteDifference (  )  const [inline]

Definition at line 740 of file graphicalmodel_factor.hxx.

Here is the call graph for this function:

template<class GRAPHICAL_MODEL >
bool opengm::Factor< GRAPHICAL_MODEL >::isTruncatedSquaredDifference (  )  const [inline]

Definition at line 712 of file graphicalmodel_factor.hxx.

Here is the call graph for this function:

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::ValueType opengm::Factor< GRAPHICAL_MODEL >::max (  )  const [inline]

Definition at line 778 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::ValueType opengm::Factor< GRAPHICAL_MODEL >::min (  )  const [inline]

Definition at line 770 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::IndexType opengm::Factor< GRAPHICAL_MODEL >::numberOfLabels ( const IndexType  j  )  const [inline]

return the number of labels of the j-th variable

Definition at line 462 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::IndexType opengm::Factor< GRAPHICAL_MODEL >::numberOfVariables (  )  const [inline]

Definition at line 470 of file graphicalmodel_factor.hxx.

Here is the caller graph for this function:

template<class GRAPHICAL_MODEL>
template<int FunctionType, class ITERATOR >
ValueType opengm::Factor< GRAPHICAL_MODEL >::operator() ( ITERATOR   )  const [inline]
template<class GRAPHICAL_MODEL >
template<int FunctionType, class ITERATOR >
Factor< GRAPHICAL_MODEL >::ValueType opengm::Factor< GRAPHICAL_MODEL >::operator() ( ITERATOR  begin  )  const [inline]

evaluate the factor for a sequence of labels

Parameters:
begin iterator to the beginning of a sequence of labels

Definition at line 502 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL > & opengm::Factor< GRAPHICAL_MODEL >::operator= ( const Factor< GRAPHICAL_MODEL > &  src  )  [inline]

Definition at line 418 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::ValueType opengm::Factor< GRAPHICAL_MODEL >::product (  )  const [inline]

Definition at line 762 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::IndexType opengm::Factor< GRAPHICAL_MODEL >::shape ( const IndexType  j  )  const [inline]

return the extension a value table encoding this factor would have in the dimension of the j-th variable

Definition at line 489 of file graphicalmodel_factor.hxx.

Here is the caller graph for this function:

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::ShapeIteratorType opengm::Factor< GRAPHICAL_MODEL >::shapeBegin (  )  const [inline]

Definition at line 432 of file graphicalmodel_factor.hxx.

Here is the caller graph for this function:

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::ShapeIteratorType opengm::Factor< GRAPHICAL_MODEL >::shapeEnd (  )  const [inline]

Definition at line 439 of file graphicalmodel_factor.hxx.

Here is the caller graph for this function:

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::IndexType opengm::Factor< GRAPHICAL_MODEL >::size (  )  const [inline]

Definition at line 830 of file graphicalmodel_factor.hxx.

Here is the call graph for this function:

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::ValueType opengm::Factor< GRAPHICAL_MODEL >::sum (  )  const [inline]

Definition at line 754 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
template<int PROPERTY>
GRAPHICAL_MODEL::ValueType opengm::Factor< GRAPHICAL_MODEL >::valueProperty (  )  const [inline]

compute a property of a factor

The property must be one of the properties defined in opengm::ValueProperties::Values

Usage:

 const size_t factorIndex=0;
 GmType::ValueType sum=gm[factorIndex]. template valueProperty<opengm::ValueProperties::Sum>();
 OPENGM_ASSERT(gm[factorIndex].sum() == sum);

Definition at line 586 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::IndexType opengm::Factor< GRAPHICAL_MODEL >::variableIndex ( const IndexType  j  )  const [inline]

return the index of the j-th variable

Definition at line 478 of file graphicalmodel_factor.hxx.

Here is the caller graph for this function:

template<class GRAPHICAL_MODEL >
template<class ITERATOR >
void opengm::Factor< GRAPHICAL_MODEL >::variableIndices ( ITERATOR  out  )  const [inline]

Definition at line 787 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::VariablesIteratorType opengm::Factor< GRAPHICAL_MODEL >::variableIndicesBegin (  )  const [inline]

Definition at line 818 of file graphicalmodel_factor.hxx.

template<class GRAPHICAL_MODEL >
Factor< GRAPHICAL_MODEL >::VariablesIteratorType opengm::Factor< GRAPHICAL_MODEL >::variableIndicesEnd (  )  const [inline]

Definition at line 824 of file graphicalmodel_factor.hxx.


Friends And Related Function Documentation

template<class GRAPHICAL_MODEL>
template<typename GM_ >
void opengm::hdf5::load ( GM_ &  ,
const std::string &  ,
const std::string &   
) [friend]
template<class GRAPHICAL_MODEL>
template<typename GM_ >
void opengm::hdf5::save ( const GM_ &  ,
const std::string &  ,
const std::string &   
) [friend]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Jun 17 16:31:11 2013 for OpenGM by  doxygen 1.6.3