diff --git a/packages/CLPBN/clpbn/bp/CFactorGraph.cpp b/packages/CLPBN/clpbn/bp/CFactorGraph.cpp index 7c7129902..dadd13a10 100644 --- a/packages/CLPBN/clpbn/bp/CFactorGraph.cpp +++ b/packages/CLPBN/clpbn/bp/CFactorGraph.cpp @@ -55,7 +55,7 @@ CFactorGraph::setInitialColors (void) VarColorMap::iterator it = colorMap.find (dsize); if (it == colorMap.end()) { it = colorMap.insert (make_pair ( - dsize, vector (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& 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::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::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]); diff --git a/packages/CLPBN/clpbn/bp/CFactorGraph.h b/packages/CLPBN/clpbn/bp/CFactorGraph.h index 1d4e42122..38ac68b1b 100644 --- a/packages/CLPBN/clpbn/bp/CFactorGraph.h +++ b/packages/CLPBN/clpbn/bp/CFactorGraph.h @@ -9,25 +9,22 @@ class VarCluster; class FacCluster; -class Distribution; class Signature; - class SignatureHash; - typedef long Color; +typedef vector Colors; -typedef unordered_map> VarColorMap; - -typedef unordered_map DistColorMap; -typedef unordered_map VarId2VarCluster; - -typedef vector VarClusters; -typedef vector FacClusters; +typedef unordered_map DistColorMap; +typedef unordered_map VarColorMap; typedef unordered_map VarSignMap; typedef unordered_map FacSignMap; +typedef vector VarClusters; +typedef vector FacClusters; + +typedef unordered_map VarId2VarCluster; struct Signature @@ -65,7 +62,7 @@ struct Signature return true; } - vector 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 varColors_; - vector facColors_; + Colors varColors_; + Colors facColors_; vector varSignatures_; vector facSignatures_; VarClusters varClusters_;