replace Util::add and Util::multiply by Util::apply_n_times

This commit is contained in:
Tiago Gomes
2012-05-28 21:09:56 +01:00
parent f489a59194
commit 54ae29ae02
3 changed files with 32 additions and 41 deletions

View File

@@ -219,7 +219,8 @@ CbpSolver::calcFactorToVarMsg (SpLink* _link)
cout << " message from " << links[i]->varNode()->label();
cout << ": " ;
}
Util::add (msgProduct, getVarToFactorMsg (links[i]), reps);
Util::apply_n_times (msgProduct, getVarToFactorMsg (links[i]),
reps, std::plus<double>());
if (Constants::SHOW_BP_CALCS) {
cout << endl;
}
@@ -234,7 +235,8 @@ CbpSolver::calcFactorToVarMsg (SpLink* _link)
cout << " message from " << links[i]->varNode()->label();
cout << ": " ;
}
Util::multiply (msgProduct, getVarToFactorMsg (links[i]), reps);
Util::apply_n_times (msgProduct, getVarToFactorMsg (links[i]),
reps, std::multiplies<double>());
if (Constants::SHOW_BP_CALCS) {
cout << endl;
}