golib
0.5
|
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 |
![]() | |
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 |
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.
|
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.
f | Functor to sum over. |
X | Input vector for f. |
i | Current index into X to sum over (start the recursion with 0). |
fixed_index | Fixed index: do not iterate over this index into X (remains fixed). |