Avoid importing the std namespace

This commit is contained in:
Tiago Gomes
2013-02-07 13:37:15 +00:00
parent 7b60e88545
commit bb7a530da3
49 changed files with 939 additions and 908 deletions

View File

@@ -64,9 +64,9 @@ ParfactorList::addShattered (Parfactor* pf)
list<Parfactor*>::iterator
std::list<Parfactor*>::iterator
ParfactorList::insertShattered (
list<Parfactor*>::iterator it,
std::list<Parfactor*>::iterator it,
Parfactor* pf)
{
return pfList_.insert (it, pf);
@@ -75,16 +75,16 @@ ParfactorList::insertShattered (
list<Parfactor*>::iterator
ParfactorList::remove (list<Parfactor*>::iterator it)
std::list<Parfactor*>::iterator
ParfactorList::remove (std::list<Parfactor*>::iterator it)
{
return pfList_.erase (it);
}
list<Parfactor*>::iterator
ParfactorList::removeAndDelete (list<Parfactor*>::iterator it)
std::list<Parfactor*>::iterator
ParfactorList::removeAndDelete (std::list<Parfactor*>::iterator it)
{
delete *it;
return pfList_.erase (it);
@@ -98,7 +98,7 @@ ParfactorList::isAllShattered (void) const
if (pfList_.size() <= 1) {
return true;
}
vector<Parfactor*> pfs (pfList_.begin(), pfList_.end());
Parfactors pfs (pfList_.begin(), pfList_.end());
for (size_t i = 0; i < pfs.size(); i++) {
assert (isShattered (pfs[i]));
}
@@ -121,7 +121,7 @@ ParfactorList::print (void) const
std::sort (pfVec.begin(), pfVec.end(), sortByParams());
for (size_t i = 0; i < pfVec.size(); i++) {
pfVec[i]->print();
cout << endl;
std::cout << std::endl;
}
}
@@ -163,8 +163,8 @@ ParfactorList::isShattered (const Parfactor* g) const
formulas[i], *(g->constr()),
formulas[j], *(g->constr())) == false) {
g->print();
cout << "-> not identical on positions " ;
cout << i << " and " << j << endl;
std::cout << "-> not identical on positions " ;
std::cout << i << " and " << j << std::endl;
return false;
}
} else {
@@ -172,8 +172,8 @@ ParfactorList::isShattered (const Parfactor* g) const
formulas[i], *(g->constr()),
formulas[j], *(g->constr())) == false) {
g->print();
cout << "-> not disjoint on positions " ;
cout << i << " and " << j << endl;
std::cout << "-> not disjoint on positions " ;
std::cout << i << " and " << j << std::endl;
return false;
}
}
@@ -200,9 +200,10 @@ ParfactorList::isShattered (
fms1[i], *(g1->constr()),
fms2[j], *(g2->constr())) == false) {
g1->print();
cout << "^" << endl;
std::cout << "^" << std::endl;
g2->print();
cout << "-> not identical on group " << fms1[i].group() << endl;
std::cout << "-> not identical on group " ;
std::cout << fms1[i].group() << std::endl;
return false;
}
} else {
@@ -210,10 +211,10 @@ ParfactorList::isShattered (
fms1[i], *(g1->constr()),
fms2[j], *(g2->constr())) == false) {
g1->print();
cout << "^" << endl;
std::cout << "^" << std::endl;
g2->print();
cout << "-> not disjoint on groups " << fms1[i].group();
cout << " and " << fms2[j].group() << endl;
std::cout << "-> not disjoint on groups " << fms1[i].group();
std::cout << " and " << fms2[j].group() << std::endl;
return false;
}
}
@@ -227,12 +228,12 @@ ParfactorList::isShattered (
void
ParfactorList::addToShatteredList (Parfactor* g)
{
queue<Parfactor*> residuals;
std::queue<Parfactor*> residuals;
residuals.push (g);
while (residuals.empty() == false) {
Parfactor* pf = residuals.front();
bool pfSplitted = false;
list<Parfactor*>::iterator pfIter;
std::list<Parfactor*>::iterator pfIter;
pfIter = pfList_.begin();
while (pfIter != pfList_.end()) {
std::pair<Parfactors, Parfactors> shattRes;
@@ -269,7 +270,7 @@ Parfactors
ParfactorList::shatterAgainstMySelf (Parfactor* g)
{
Parfactors pfs;
queue<Parfactor*> residuals;
std::queue<Parfactor*> residuals;
residuals.push (g);
bool shattered = true;
while (residuals.empty() == false) {
@@ -325,19 +326,22 @@ ParfactorList::shatterAgainstMySelf (
{
/*
Util::printDashedLine();
cout << "-> SHATTERING" << endl;
std::cout << "-> SHATTERING" << std::endl;
g->print();
cout << "-> ON: " << g->argument (fIdx1) << "|" ;
cout << g->constr()->tupleSet (g->argument (fIdx1).logVars()) << endl;
cout << "-> ON: " << g->argument (fIdx2) << "|" ;
cout << g->constr()->tupleSet (g->argument (fIdx2).logVars()) << endl;
std::cout << "-> ON: " << g->argument (fIdx1) << "|" ;
std::cout << g->constr()->tupleSet (g->argument (fIdx1).logVars());
std::cout << std::endl;
std::cout << "-> ON: " << g->argument (fIdx2) << "|" ;
std::cout << g->constr()->tupleSet (g->argument (fIdx2).logVars())
std::cout << std::endl;
Util::printDashedLine();
*/
ProbFormula& f1 = g->argument (fIdx1);
ProbFormula& f2 = g->argument (fIdx2);
if (f1.isAtom()) {
cerr << "Error: a ground occurs twice in the same parfactor." << endl;
cerr << endl;
std::cerr << "Error: a ground occurs twice in the same parfactor." ;
std::cerr << std::endl;
std::cerr << std::endl;
exit (EXIT_FAILURE);
}
assert (g->constr()->empty() == false);
@@ -441,14 +445,14 @@ ParfactorList::shatter (
ProbFormula& f2 = g2->argument (fIdx2);
/*
Util::printDashedLine();
cout << "-> SHATTERING" << endl;
std::cout << "-> SHATTERING" << std::endl;
g1->print();
cout << "-> WITH" << endl;
std::cout << "-> WITH" << std::endl;
g2->print();
cout << "-> ON: " << f1 << "|" ;
cout << g1->constr()->tupleSet (f1.logVars()) << endl;
cout << "-> ON: " << f2 << "|" ;
cout << g2->constr()->tupleSet (f2.logVars()) << endl;
std::cout << "-> ON: " << f1 << "|" ;
std::cout << g1->constr()->tupleSet (f1.logVars()) << std::endl;
std::cout << "-> ON: " << f2 << "|" ;
std::cout << g2->constr()->tupleSet (f2.logVars()) << std::endl;
Util::printDashedLine();
*/
if (f1.isAtom()) {
@@ -486,12 +490,12 @@ ParfactorList::shatter (
assert (commCt1->tupleSet (f1.logVars()) ==
commCt2->tupleSet (f2.logVars()));
// stringstream ss1; ss1 << "" << count << "_A.dot" ;
// stringstream ss2; ss2 << "" << count << "_B.dot" ;
// stringstream ss3; ss3 << "" << count << "_A_comm.dot" ;
// stringstream ss4; ss4 << "" << count << "_A_excl.dot" ;
// stringstream ss5; ss5 << "" << count << "_B_comm.dot" ;
// stringstream ss6; ss6 << "" << count << "_B_excl.dot" ;
// std::stringstream ss1; ss1 << "" << count << "_A.dot" ;
// std::stringstream ss2; ss2 << "" << count << "_B.dot" ;
// std::stringstream ss3; ss3 << "" << count << "_A_comm.dot" ;
// std::stringstream ss4; ss4 << "" << count << "_A_excl.dot" ;
// std::stringstream ss5; ss5 << "" << count << "_B_comm.dot" ;
// std::stringstream ss6; ss6 << "" << count << "_B_excl.dot" ;
// g1->constr()->exportToGraphViz (ss1.str().c_str(), true);
// g2->constr()->exportToGraphViz (ss2.str().c_str(), true);
// commCt1->exportToGraphViz (ss3.str().c_str(), true);