Change LiftedOperations to be a namespace instead of class with static member functions

This commit is contained in:
Tiago Gomes 2013-02-16 16:00:53 +00:00
parent be24ff5160
commit d0f5d0f9ab
2 changed files with 27 additions and 30 deletions

View File

@ -7,10 +7,16 @@
namespace Horus { namespace Horus {
namespace LiftedOperations {
namespace {
Parfactors absorve (ObservedFormula& obsFormula, Parfactor* g);
}
void void
LiftedOperations::shatterAgainstQuery ( shatterAgainstQuery (ParfactorList& pfList, const Grounds& query)
ParfactorList& pfList,
const Grounds& query)
{ {
for (size_t i = 0; i < query.size(); i++) { for (size_t i = 0; i < query.size(); i++) {
if (query[i].isAtom()) { if (query[i].isAtom()) {
@ -61,9 +67,7 @@ LiftedOperations::shatterAgainstQuery (
void void
LiftedOperations::runWeakBayesBall ( runWeakBayesBall (ParfactorList& pfList, const Grounds& query)
ParfactorList& pfList,
const Grounds& query)
{ {
std::queue<PrvGroup> todo; // groups to process std::queue<PrvGroup> todo; // groups to process
std::set<PrvGroup> done; // processed or in queue std::set<PrvGroup> done; // processed or in queue
@ -122,9 +126,7 @@ LiftedOperations::runWeakBayesBall (
void void
LiftedOperations::absorveEvidence ( absorveEvidence (ParfactorList& pfList, ObservedFormulas& obsFormulas)
ParfactorList& pfList,
ObservedFormulas& obsFormulas)
{ {
for (size_t i = 0; i < obsFormulas.size(); i++) { for (size_t i = 0; i < obsFormulas.size(); i++) {
Parfactors newPfs; Parfactors newPfs;
@ -161,9 +163,7 @@ LiftedOperations::absorveEvidence (
Parfactors Parfactors
LiftedOperations::countNormalize ( countNormalize (Parfactor* g, const LogVarSet& set)
Parfactor* g,
const LogVarSet& set)
{ {
Parfactors normPfs; Parfactors normPfs;
if (set.empty()) { if (set.empty()) {
@ -180,7 +180,7 @@ LiftedOperations::countNormalize (
Parfactor Parfactor
LiftedOperations::calcGroundMultiplication (Parfactor pf) calcGroundMultiplication (Parfactor pf)
{ {
LogVarSet lvs = pf.constr()->logVarSet(); LogVarSet lvs = pf.constr()->logVarSet();
lvs -= pf.constr()->singletons(); lvs -= pf.constr()->singletons();
@ -212,10 +212,10 @@ LiftedOperations::calcGroundMultiplication (Parfactor pf)
namespace {
Parfactors Parfactors
LiftedOperations::absorve ( absorve (ObservedFormula& obsFormula, Parfactor* g)
ObservedFormula& obsFormula,
Parfactor* g)
{ {
Parfactors absorvedPfs; Parfactors absorvedPfs;
const ProbFormulas& formulas = g->arguments(); const ProbFormulas& formulas = g->arguments();
@ -275,5 +275,9 @@ LiftedOperations::absorve (
return absorvedPfs; return absorvedPfs;
} }
}
} // namespace LiftedOperations
} // namespace Horus } // namespace Horus

View File

@ -6,26 +6,19 @@
namespace Horus { namespace Horus {
class LiftedOperations { namespace LiftedOperations {
public:
static void shatterAgainstQuery (
ParfactorList& pfList, const Grounds& query);
static void runWeakBayesBall ( void shatterAgainstQuery (ParfactorList& pfList, const Grounds& query);
ParfactorList& pfList, const Grounds&);
static void absorveEvidence ( void runWeakBayesBall (ParfactorList& pfList, const Grounds& query);
ParfactorList& pfList, ObservedFormulas& obsFormulas);
static Parfactors countNormalize (Parfactor*, const LogVarSet&); void absorveEvidence (ParfactorList& pfList, ObservedFormulas&);
static Parfactor calcGroundMultiplication (Parfactor pf); Parfactors countNormalize (Parfactor*, const LogVarSet&);
private: Parfactor calcGroundMultiplication (Parfactor pf);
static Parfactors absorve (ObservedFormula&, Parfactor*);
DISALLOW_COPY_AND_ASSIGN (LiftedOperations); } // namespace LiftedOperations
};
} // namespace Horus } // namespace Horus