📄 loopystime.h
字号:
#include "InferenceAlgorithm.h"#include <math.h>#ifndef __LOOPY_SAVE_TIME__#define __LOOPY_SAVE_TIME__class LoopySTime : public InferenceAlgorithm { /** This class makes inference using Loopy Belief Propagation algorithm, in mode of saving time but wasting space for the messages Part of the c_inference package @version November 2004 @author Talya Meltzer */ public: // ctor LoopySTime(MRF const* mrf, SumOrMax m = MAX, Strategy s = SEQUENTIAL, int maxIter = 2000, double** trwRho = 0, double*** initMsg = 0, double th = pow(10.,-8)) : InferenceAlgorithm(mrf), l_strategy(s), l_sumOrMax(m), l_maxIter(maxIter), l_th(th) { l_messages = 0; l_pairBeliefs = 0; l_trwRho = 0; initMessages(initMsg); initPairBeliefs(); initTRWRho(trwRho); } virtual ~LoopySTime(); // dtor virtual double** inference(int* converged); virtual double** inferenceTRBP(int* converged); void initMessages(double*** initMsg); void initPairBeliefs(); void initTRWRho(double** trwRho); virtual double**** calcPairBeliefs(); virtual double**** calcPairBeliefsTRBP(); double*** getMessages() { return l_messages; } protected: Strategy l_strategy; // strategy of updating double*** l_messages; // the messages from node to node double**** l_pairBeliefs; // the pairwise beliefs SumOrMax l_sumOrMax; // use sum or max int l_maxIter; // maximum number of iterations in inference double l_th; // threshold for convergence double** l_trwRho; // rho values for each edge in trw mode void freeMessages(); void freePairBeliefs(); void freeTRWRho();};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -