44 Algfb() : m_nOrder(0), m_nLen(0), m_nValueLimit(0) {};
47 void Prepare(
int nLen,
int nOrder,
int nValueLimit);
55 virtual LogP ClusterSum(
int *pSeq,
int nLen,
int nPos,
int nOrder) = 0;
71 Msg(
int nMsgDim,
int nSize);
75 float& Get(
int *pIdx,
int nDim);
91 VecIter(
int *p,
int nDim,
int nMin,
int nMax);
int m_nMin
the min value of each dimension
int m_nLen
the sequence length.
void Prepare(int nLen, int nOrder, int nValueLimit)
prepare
int m_nValueLimit
the max-value at each position
int m_nOrder
the order, i.e. the node number at each cluster {x_1,x_2,...,x_n}
virtual LogP ClusterSum(int *pSeq, int nLen, int nPos, int nOrder)=0
This function need be derived. Calcualte the log probability of each cluster.
Array< Msg * > m_aAlpha
the forward message
int m_nMax
the max value of eahc dimension
LogP GetLogSummation()
Get the summation over the sequence, corresponding to the log normalization constants 'logZ'...
void ForwardBackward(int nLen, int nOrder, int nValueLimit)
forward-backward calculation
LogP GetMarginalLogProb(int nPos, int *pSubSeq, int nSubLen, double logz=0)
Get the marginal probability. 'logz' is the input of the log normalization constants.
Array< Msg * > m_aBeta
the backward message