本文整理汇总了C++中Var::label方法的典型用法代码示例。如果您正苦于以下问题:C++ Var::label方法的具体用法?C++ Var::label怎么用?C++ Var::label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Var
的用法示例。
在下文中一共展示了Var::label方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find
std::vector<std::map<size_t, int> > AnyPositionCnfCompress::createCounts(size_t &gndFactor, VarSet &superVarSet) {
// create zero entries for each position
map<long, map<size_t, int> > countMap;
foreach (const dai::BipartiteGraph::Neighbor &tmpVar, _cfg.nbF(gndFactor)) {
Var liftedVar = _varRepr[_varColorVec[tmpVar]];
size_t pos = find(_cfg.factor(gndFactor).sigma().begin(), _cfg.factor(gndFactor).sigma().end(), tmpVar.iter) - _cfg.factor(gndFactor).sigma().begin();
countMap[liftedVar.label()][pos] = 0;
}
vector<map<size_t, int> > counts;
size_t posCount;
size_t negCount;
for (vector<Var>::const_iterator iter = superVarSet.begin(); iter < superVarSet.end(); iter++) {
posCount = 0;
negCount = 0;
foreach(const dai::BipartiteGraph::Neighbor tmpFac, _cfg.nbV(_cfg.findVar(*iter))) {
if (_facRepr[_facColorVec[tmpFac]] == gndFactor) {
size_t pos = find(_cfg.factor(tmpFac).sigma().begin(), _cfg.factor(tmpFac).sigma().end(), tmpFac.dual) - _cfg.factor(tmpFac).sigma().begin();
double res = log(_cfg.factor(tmpFac).states() - _zeroStates[tmpFac]) / log(2);
size_t nrPosLiterals = size_t(res);
bool sign = (pos < nrPosLiterals);
if (sign) {
posCount++;
} else {
negCount++;
}
}
}
map<size_t, int>::iterator posIter=countMap[iter->label()].begin();
if (posCount > 0) {
posIter->second = posCount;
}
if (negCount > 0) {
for (size_t j=0;j<posCount; j++, posIter++) {}
posIter->second = negCount;
}
counts.push_back(countMap[iter->label()]);
}
return counts;
}
示例2: find
std::vector<std::map<size_t, int> > CompressInterface::createCounts(size_t &gndFactor, VarSet &superVarSet) {
// create zero entries for each position
map<long, map<size_t, int> > countMap;
foreach (const dai::BipartiteGraph::Neighbor &tmpVar, _cfg.nbF(gndFactor)) {
Var liftedVar = _varRepr[_varColorVec[tmpVar]];
size_t pos = find(_cfg.factor(gndFactor).sigma().begin(), _cfg.factor(gndFactor).sigma().end(), tmpVar.iter) - _cfg.factor(gndFactor).sigma().begin();
countMap[liftedVar.label()][pos] = 0;
}
vector<map<size_t, int> > counts;
for (vector<Var>::const_iterator iter = superVarSet.begin(); iter < superVarSet.end(); iter++) {
foreach(const dai::BipartiteGraph::Neighbor gndFac, _cfg.nbV(_cfg.findVar(*iter))) {
if (_facRepr[_facColorVec[gndFac]] == gndFactor) {
size_t pos = find(_cfg.factor(gndFac).sigma().begin(), _cfg.factor(gndFac).sigma().end(), gndFac.dual) - _cfg.factor(gndFac).sigma().begin();
countMap[iter->label()][pos]++;
}
}
counts.push_back(countMap[iter->label()]);
}
return counts;
}