本文整理汇总了C++中MultiVector::end方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiVector::end方法的具体用法?C++ MultiVector::end怎么用?C++ MultiVector::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiVector
的用法示例。
在下文中一共展示了MultiVector::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateNode
void LinearCheckNodeUpdater::updateNode(
unsigned int nodeInd,
MultiVector<float>& messages)
{
uint32_t begin = messages.begin(nodeInd);
uint32_t end = messages.end(nodeInd);
uint32_t N = end - begin;
if(N == 1) {
messages[begin] = m_checkNodesPriorLogPmQ[nodeInd].getFloat();
return;
}
// Convert all message values into log(p-q) values
for (unsigned int j = begin; j < end; j++) {
m_messagesPmQ.push_back(LogPmQ(messages[j]));
}
// calculate the multiplication from the right of p-q values:
// rightSum[j] = encodedSoftBit[i] * messages[-1].p-q * messages[-2].p-q * ... * messages[-j].p-q
LogPmQ curSum = m_checkNodesPriorLogPmQ[nodeInd]; // get log(p-q)
m_rightSum.push_back(curSum);
// go over all messages except the first one (which will never be
// needed anyway)
for(unsigned int rightInd = N - 1; rightInd > 0; rightInd--) {
curSum += m_messagesPmQ[rightInd];
m_rightSum.push_back(curSum);
}
// special case for j = 0
messages[begin] = m_rightSum[N - 1].getFloat();
// now we use curSum as the cumulative multiplication from the
// left rather than right
curSum = m_messagesPmQ[0];
for (unsigned int j = 1; j < N; j++) {
messages[begin + j] = (curSum + m_rightSum[N - j - 1]).getFloat();
//assert(isfinite(messages[begin + j]));
curSum += m_messagesPmQ[j];
}
m_rightSum.clear();
m_messagesPmQ.clear();
}
示例2: updateNode
void LinearCheckNodeUpdater::updateNode(
unsigned int nodeInd,
MultiVector<BipartiteBP::QLLR>& messages)
{
uint32_t begin = messages.begin(nodeInd);
uint32_t end = messages.end(nodeInd);
uint32_t N = end - begin;
#ifdef SUPER_VERBOSE
std::cout << "CheckNode " << nodeInd << " \t" << N << " neighbors: ";
for (uint32_t jj = 0; jj < N; jj++) {
std::cout << messages[begin + jj] << ", ";
}
std::cout << std::endl;
#endif
if(N == 1) {
messages[begin] = m_checkNodesPriorQLLR[nodeInd];
return;
}
// Convert all message values into log(p-q) values
for (unsigned int j = begin; j < end; j++) {
m_messagesWorkArr.push_back(messages[j]);
}
// calculate the multiplication from the right of p-q values:
// rightSum[j] = encodedSoftBit[i] * messages[-1].p-q * messages[-2].p-q * ... * messages[-j].p-q
itpp::QLLR curSum = m_checkNodesPriorQLLR[nodeInd]; // get log(p-q)
m_rightSum.push_back(curSum);
// go over all messages except the first one (which will never be
// needed anyway)
for(unsigned int rightInd = N - 1; rightInd > 0; rightInd--) {
#ifdef SUPER_VERBOSE
std::cout << "\t\tcurSum=" << curSum << " qllr=" << m_messagesWorkArr[rightInd] <<
" boxPlus=" << m_llrCalc.Boxplus(curSum, m_messagesWorkArr[rightInd]) << std::endl;
#endif
curSum = m_llrCalc.Boxplus(curSum, m_messagesWorkArr[rightInd]);
m_rightSum.push_back(curSum);
}
#ifdef SUPER_VERBOSE
std::cout << "\t\tRightSum: ";
for (uint32_t jj = 0; jj < N; jj++) {
std::cout << m_rightSum[jj] << ", ";
}
std::cout << std::endl;
#endif
// special case for j = 0
messages[begin] = m_rightSum[N - 1];
// now we use curSum as the cumulative multiplication from the
// left rather than right
curSum = m_messagesWorkArr[0];
for (unsigned int j = 1; j < N; j++) {
messages[begin + j] = m_llrCalc.Boxplus(curSum, m_rightSum[N - j - 1]);
//assert(isfinite(messages[begin + j]));
curSum = m_llrCalc.Boxplus(curSum, m_messagesWorkArr[j]);
}
m_rightSum.clear();
m_messagesWorkArr.clear();
#ifdef SUPER_VERBOSE
std::cout << "\t\tOut: ";
for (uint32_t jj = 0; jj < N; jj++) {
std::cout << messages[begin + jj] << ", ";
}
std::cout << std::endl;
#endif
}