add typedef
This commit is contained in:
parent
05ef8610f4
commit
24a5fe9c23
@ -55,7 +55,7 @@ CFactorGraph::setInitialColors (void)
|
|||||||
VarColorMap::iterator it = colorMap.find (dsize);
|
VarColorMap::iterator it = colorMap.find (dsize);
|
||||||
if (it == colorMap.end()) {
|
if (it == colorMap.end()) {
|
||||||
it = colorMap.insert (make_pair (
|
it = colorMap.insert (make_pair (
|
||||||
dsize, vector<Color> (dsize+1,-1))).first;
|
dsize, Colors (dsize+1,-1))).first;
|
||||||
}
|
}
|
||||||
unsigned idx;
|
unsigned idx;
|
||||||
if (varNodes[i]->hasEvidence()) {
|
if (varNodes[i]->hasEvidence()) {
|
||||||
@ -63,7 +63,7 @@ CFactorGraph::setInitialColors (void)
|
|||||||
} else {
|
} else {
|
||||||
idx = dsize;
|
idx = dsize;
|
||||||
}
|
}
|
||||||
vector<Color>& stateColors = it->second;
|
Colors& stateColors = it->second;
|
||||||
if (stateColors[idx] == -1) {
|
if (stateColors[idx] == -1) {
|
||||||
stateColors[idx] = getFreeColor();
|
stateColors[idx] = getFreeColor();
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ const Signature&
|
|||||||
CFactorGraph::getSignature (const VarNode* varNode)
|
CFactorGraph::getSignature (const VarNode* varNode)
|
||||||
{
|
{
|
||||||
Signature& sign = varSignatures_[varNode->getIndex()];
|
Signature& sign = varSignatures_[varNode->getIndex()];
|
||||||
vector<Color>::iterator it = sign.colors.begin();
|
Colors::iterator it = sign.colors.begin();
|
||||||
const FacNodes& neighs = varNode->neighbors();
|
const FacNodes& neighs = varNode->neighbors();
|
||||||
for (unsigned i = 0; i < neighs.size(); i++) {
|
for (unsigned i = 0; i < neighs.size(); i++) {
|
||||||
*it = getColor (neighs[i]);
|
*it = getColor (neighs[i]);
|
||||||
@ -228,7 +228,7 @@ const Signature&
|
|||||||
CFactorGraph::getSignature (const FacNode* facNode)
|
CFactorGraph::getSignature (const FacNode* facNode)
|
||||||
{
|
{
|
||||||
Signature& sign = facSignatures_[facNode->getIndex()];
|
Signature& sign = facSignatures_[facNode->getIndex()];
|
||||||
vector<Color>::iterator it = sign.colors.begin();
|
Colors::iterator it = sign.colors.begin();
|
||||||
const VarNodes& neighs = facNode->neighbors();
|
const VarNodes& neighs = facNode->neighbors();
|
||||||
for (unsigned i = 0; i < neighs.size(); i++) {
|
for (unsigned i = 0; i < neighs.size(); i++) {
|
||||||
*it = getColor (neighs[i]);
|
*it = getColor (neighs[i]);
|
||||||
|
@ -9,25 +9,22 @@
|
|||||||
|
|
||||||
class VarCluster;
|
class VarCluster;
|
||||||
class FacCluster;
|
class FacCluster;
|
||||||
class Distribution;
|
|
||||||
class Signature;
|
class Signature;
|
||||||
|
|
||||||
class SignatureHash;
|
class SignatureHash;
|
||||||
|
|
||||||
|
|
||||||
typedef long Color;
|
typedef long Color;
|
||||||
|
typedef vector<Color> Colors;
|
||||||
typedef unordered_map<unsigned, vector<Color>> VarColorMap;
|
|
||||||
|
|
||||||
typedef unordered_map<unsigned, Color> DistColorMap;
|
typedef unordered_map<unsigned, Color> DistColorMap;
|
||||||
typedef unordered_map<VarId, VarCluster*> VarId2VarCluster;
|
typedef unordered_map<unsigned, Colors> VarColorMap;
|
||||||
|
|
||||||
typedef vector<VarCluster*> VarClusters;
|
|
||||||
typedef vector<FacCluster*> FacClusters;
|
|
||||||
|
|
||||||
typedef unordered_map<Signature, VarNodes, SignatureHash> VarSignMap;
|
typedef unordered_map<Signature, VarNodes, SignatureHash> VarSignMap;
|
||||||
typedef unordered_map<Signature, FacNodes, SignatureHash> FacSignMap;
|
typedef unordered_map<Signature, FacNodes, SignatureHash> FacSignMap;
|
||||||
|
|
||||||
|
typedef vector<VarCluster*> VarClusters;
|
||||||
|
typedef vector<FacCluster*> FacClusters;
|
||||||
|
|
||||||
|
typedef unordered_map<VarId, VarCluster*> VarId2VarCluster;
|
||||||
|
|
||||||
|
|
||||||
struct Signature
|
struct Signature
|
||||||
@ -65,7 +62,7 @@ struct Signature
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Color> colors;
|
Colors colors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -233,8 +230,8 @@ class CFactorGraph
|
|||||||
void printGroups (const VarSignMap&, const FacSignMap&) const;
|
void printGroups (const VarSignMap&, const FacSignMap&) const;
|
||||||
|
|
||||||
Color freeColor_;
|
Color freeColor_;
|
||||||
vector<Color> varColors_;
|
Colors varColors_;
|
||||||
vector<Color> facColors_;
|
Colors facColors_;
|
||||||
vector<Signature> varSignatures_;
|
vector<Signature> varSignatures_;
|
||||||
vector<Signature> facSignatures_;
|
vector<Signature> facSignatures_;
|
||||||
VarClusters varClusters_;
|
VarClusters varClusters_;
|
||||||
|
Reference in New Issue
Block a user