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