regions-new.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // (C) 2002 Marshall Tappen, MIT AI Lab
  2. #ifndef _reg_h
  3. #define _reg_h
  4. #define FLOATTYPE float
  5. #define UP 0
  6. #define DOWN 1
  7. #define LEFT 2
  8. #define RIGHT 3
  9. #include "MaxProdBP.h"
  10. namespace OBJREC {
  11. class MaxProdBP;
  12. class OneNodeCluster
  13. {
  14. public:
  15. OneNodeCluster();
  16. //static const int UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3;
  17. static int numStates;
  18. FLOATTYPE *receivedMsgs[4],
  19. *nextRoundReceivedMsgs[4],
  20. *localEv;
  21. // FLOATTYPE *psi[4];
  22. void ComputeMsgRight(FLOATTYPE *msgDest, int r, int c, MaxProdBP *mrf);
  23. void ComputeMsgUp(FLOATTYPE *msgDest, int r, int c, MaxProdBP *mrf);
  24. void ComputeMsgLeft(FLOATTYPE *msgDest, int r, int c, MaxProdBP *mrf);
  25. void ComputeMsgDown(FLOATTYPE *msgDest, int r, int c, MaxProdBP *mrf);
  26. void getBelief(FLOATTYPE *beliefVec);
  27. int getBeliefMaxInd();
  28. int msgChange(FLOATTYPE thresh);
  29. void deliverMsgs();
  30. };
  31. void initOneNodeMsgMem(OneNodeCluster *nodeArray, FLOATTYPE *memChunk, const int numNodes,
  32. const int msgChunkSize);
  33. void computeMessagesUpDown(OneNodeCluster *nodeArray, const int numCols, const int numRows,
  34. const int currCol, const FLOATTYPE alpha, MaxProdBP *mrf);
  35. void computeMessagesLeftRight(OneNodeCluster *nodeArray, const int numCols, const int numRows,
  36. const int currRow, const FLOATTYPE alpha, MaxProdBP *mrf);
  37. void computeOneNodeMessagesPeriodic(OneNodeCluster *nodeTopArray, OneNodeCluster *nodeBotArray,
  38. const int numCols, const FLOATTYPE alpha);
  39. } // namespace
  40. #endif