本文整理汇总了C++中CFactor::sigma方法的典型用法代码示例。如果您正苦于以下问题:C++ CFactor::sigma方法的具体用法?C++ CFactor::sigma怎么用?C++ CFactor::sigma使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactor
的用法示例。
在下文中一共展示了CFactor::sigma方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rearrangeCnfFactor
void CompressInterface::rearrangeCnfFactor(CFactor &cnfClause) {
State state(cnfClause.vars());
vector<size_t> (cnfClause.vars().size());
vector<size_t> pos,neg,sigma;
for (size_t i=0; i<cnfClause.states(); i++) {
if (cnfClause[i] == 1) {
for (vector<Var>::const_iterator varIter=cnfClause.vars().begin(); varIter!=cnfClause.vars().end();varIter++) {
if (state(*varIter) == 0) {
pos.push_back(varIter - cnfClause.vars().begin());
} else {
neg.push_back(varIter - cnfClause.vars().begin());
}
}
break;
} else if (cnfClause[i] == 0) {
//TODO handle factors which contain zero states
// in such cases the possible zero state could have been clamped;
// possible solutions:
// i) restore factor from backup (requires to clamp factors accordingly)
// ii) cache zero states in advance
return;
}
state++;
}
sigma.insert(sigma.begin(),pos.begin(), pos.end());
sigma.insert(sigma.begin() + pos.size(),neg.begin(), neg.end());
cnfClause.sigma() = sigma;
}
示例2: createCFactorGraph
CFactorGraph CompressInterface::createCFactorGraph() {
createVarClustering();
createFacClustering();
// create lifted fg here
vector<CFactor> superFacs;
// clusterIdx => facIdx
for (map<size_t,size_t>::iterator facIter = _facRepr.begin(); facIter != _facRepr.end(); facIter++) {
VarSet superVarSet;
foreach (const dai::BipartiteGraph::Neighbor &tmpVar, _cfg.nbF(facIter->second)) {
Var varCluster = _varRepr[_varColorVec[tmpVar]];
if (!superVarSet.contains(varCluster)) {
superVarSet |= Var(varCluster);
}
}
CFactor superFac = CFactor(superVarSet, _cfg.factor(facIter->second).p());
superFac.sigma() = _cfg.factor(facIter->second).sigma();
superFac.position() = _cfg.factor(facIter->second).position();
superFac.counts() = createCounts(facIter->second, superVarSet);
superFacs.push_back(superFac);
}
return CFactorGraph(superFacs);
}