#include <dai/bp_dual.h>
Public Member Functions | |
BP_dual (const InfAlg *ia) | |
Construct BP_dual object from (converged) InfAlg object's beliefs and factors. | |
const FactorGraph & | fg () const |
Returns the underlying FactorGraph. | |
Prob & | msgM (size_t i, size_t _I) |
Returns reference to factor->variable message (I -> i). | |
const Prob & | msgM (size_t i, size_t _I) const |
Returns constant reference to factor->variable message (I -> i). | |
Prob & | msgN (size_t i, size_t _I) |
Returns reference to variable -> factor message (i -> I). | |
const Prob & | msgN (size_t i, size_t _I) const |
Returns constant reference to variable -> factor message (i -> I). | |
Real & | zM (size_t i, size_t _I) |
Returns reference to normalizer for factor->variable message (I -> i). | |
const Real & | zM (size_t i, size_t _I) const |
Returns constant reference to normalizer for factor->variable message (I -> i). | |
Real & | zN (size_t i, size_t _I) |
Returns reference to normalizer for variable -> factor message (i -> I). | |
const Real & | zN (size_t i, size_t _I) const |
Returns constant reference to normalizer for variable -> factor message (i -> I). | |
Factor | beliefV (size_t i) const |
Returns belief of variable i. | |
Factor | beliefF (size_t I) const |
Returns belief of factor I. | |
Real | beliefVZ (size_t i) const |
Returns normalizer for belief of variable i. | |
Real | beliefFZ (size_t I) const |
Returns normalizer for belief of factor I. | |
Protected Member Functions | |
void | init () |
Does all necessary preprocessing. | |
void | regenerateMessages () |
Allocates space for _msgs. | |
void | regenerateBeliefs () |
Allocates space for _beliefs. | |
void | calcMessages () |
Calculate all messages from InfAlg beliefs. | |
void | calcNewM (size_t i, size_t _I) |
Update factor->variable message (i -> I). | |
void | calcNewN (size_t i, size_t _I) |
Update variable->factor message (I -> i). | |
void | calcBeliefs () |
Calculate all variable and factor beliefs from messages. | |
void | calcBeliefV (size_t i) |
Calculate belief of variable i. | |
void | calcBeliefF (size_t I) |
Calculate belief of factor I. | |
Protected Attributes | |
messages | _msgs |
Stores all messages. | |
beliefs | _beliefs |
Stores all beliefs. | |
const InfAlg * | _ia |
Pointer to the InfAlg object. | |
Classes | |
struct | _edges_t |
Convenience label for storing edge properties. More... | |
struct | beliefs |
Groups together the data structures for storing the two types of beliefs and their normalizers. More... | |
struct | messages |
Groups together the data structures for storing the two types of messages and their normalizers. More... |
BP_dual calculates "dual" versions of BP messages (both messages from factors to variables and messages from variables to factors), and normalizers, given an InfAlg. These are computed from the variable and factor beliefs of the InfAlg. This class is used primarily by BBP.
dai::BP_dual::BP_dual | ( | const InfAlg * | ia | ) | [inline] |
void dai::BP_dual::init | ( | ) | [protected] |
Does all necessary preprocessing.
void dai::BP_dual::regenerateMessages | ( | ) | [protected] |
Allocates space for _msgs.
void dai::BP_dual::regenerateBeliefs | ( | ) | [protected] |
Allocates space for _beliefs.
void dai::BP_dual::calcNewM | ( | size_t | i, | |
size_t | _I | |||
) | [protected] |
Update factor->variable message (i -> I).
void dai::BP_dual::calcNewN | ( | size_t | i, | |
size_t | _I | |||
) | [protected] |
Update variable->factor message (I -> i).
void dai::BP_dual::calcBeliefs | ( | ) | [protected] |
void dai::BP_dual::calcBeliefV | ( | size_t | i | ) | [protected] |
Calculate belief of variable i.
void dai::BP_dual::calcBeliefF | ( | size_t | I | ) | [protected] |
Calculate belief of factor I.
const FactorGraph& dai::BP_dual::fg | ( | ) | const [inline] |
Returns the underlying FactorGraph.
Prob& dai::BP_dual::msgM | ( | size_t | i, | |
size_t | _I | |||
) | [inline] |
Returns reference to factor->variable message (I -> i).
const Prob& dai::BP_dual::msgM | ( | size_t | i, | |
size_t | _I | |||
) | const [inline] |
Returns constant reference to factor->variable message (I -> i).
Prob& dai::BP_dual::msgN | ( | size_t | i, | |
size_t | _I | |||
) | [inline] |
Returns reference to variable -> factor message (i -> I).
const Prob& dai::BP_dual::msgN | ( | size_t | i, | |
size_t | _I | |||
) | const [inline] |
Returns constant reference to variable -> factor message (i -> I).
Real& dai::BP_dual::zM | ( | size_t | i, | |
size_t | _I | |||
) | [inline] |
Returns reference to normalizer for factor->variable message (I -> i).
const Real& dai::BP_dual::zM | ( | size_t | i, | |
size_t | _I | |||
) | const [inline] |
Returns constant reference to normalizer for factor->variable message (I -> i).
Real& dai::BP_dual::zN | ( | size_t | i, | |
size_t | _I | |||
) | [inline] |
Returns reference to normalizer for variable -> factor message (i -> I).
const Real& dai::BP_dual::zN | ( | size_t | i, | |
size_t | _I | |||
) | const [inline] |
Returns constant reference to normalizer for variable -> factor message (i -> I).
Factor dai::BP_dual::beliefV | ( | size_t | i | ) | const [inline] |
Returns belief of variable i.
Factor dai::BP_dual::beliefF | ( | size_t | I | ) | const [inline] |
Returns belief of factor I.
Real dai::BP_dual::beliefVZ | ( | size_t | i | ) | const [inline] |
Returns normalizer for belief of variable i.
Real dai::BP_dual::beliefFZ | ( | size_t | I | ) | const [inline] |
Returns normalizer for belief of factor I.
messages dai::BP_dual::_msgs [protected] |
Stores all messages.
beliefs dai::BP_dual::_beliefs [protected] |
Stores all beliefs.
const InfAlg* dai::BP_dual::_ia [protected] |
Pointer to the InfAlg object.