golib  0.5
goMessagePassing< T, Tfloat > Class Template Referenceabstract

Base class for message passing algorithms. More...

#include <gomessagepassing.h>

Public Types

enum  Direction { FORWARD, BACKWARD }
 

Public Member Functions

virtual bool run (goFGNode< T, Tfloat > *root, goFactorGraph< T, Tfloat > &fg)=0
 
goDouble sum (goFunctorBase1< Tfloat, const goMath::Vector< T > & > *f, goMath::Vector< T > &X, goSize_t i, goSize_t fixed_index)
 Recursive sum. More...
 
void setValueCount (goSize_t c)
 
goSize_t getValueCount () const
 
void setDirection (Direction d)
 
Direction getDirection () const
 
- Public Member Functions inherited from goGraphAlgorithm< goFGNode< T, Tfloat >, goFGEdge< T, Tfloat > >
bool breadthFirst (goFGNode< T, Tfloat > *root)
 BFS. More...
 
bool breadthFirstTree (goFGNode< T, Tfloat > *root)
 
bool depthFirstRecursive (goFGNode< T, Tfloat > *root)
 
bool depthFirst (goFGNode< T, Tfloat > *root)
 
bool depthFirstTree (goFGNode< T, Tfloat > *root)
 Same as depthFirst(), plus fills parent fields in the nodes. More...
 
virtual bool action (goFGNode< T, Tfloat > *node)
 
virtual bool action (const goFGNode< T, Tfloat > *node) const
 

Detailed Description

template<class T, class Tfloat>
class goMessagePassing< T, Tfloat >

Base class for message passing algorithms.

Sum-product and max-sum are implemented in the class templates goMaxSum and goSumProduct.

This does also terminate for graphs with loops, but the result may be very bad. Loopy belief propagation with scheduling other than "two-way" is not yet implemented; initialisation of messages is also not yet implemented.

  • T Type for the variables (currently recommended to be integer, since [0,myValueCount-1] is used as values).
  • Tfloat Floating point type for the "message" vectors. Determines the accuracy. Set to goFloat or goDouble.

Member Function Documentation

◆ sum()

template<class T , class Tfloat >
goDouble goMessagePassing< T, Tfloat >::sum ( goFunctorBase1< Tfloat, const goMath::Vector< T > & > *  f,
goMath::Vector< T > &  X,
goSize_t  i,
goSize_t  fixed_index 
)
inline

Recursive sum.

Sums f over all variables except fixed_index. Currently just uses the indices as input functions for the function f(). If other values should be used, change this function accordingly.

Note
This function is not used in this class, but left for completeness.
Parameters
fFunctor to sum over.
XInput vector for f.
iCurrent index into X to sum over (start the recursion with 0).
fixed_indexFixed index: do not iterate over this index into X (remains fixed).
Returns
The sum of f over all variables except fixed_index.

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