From 57e32267feaf2e5f26d5c356d1b96cdf5122b67e Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Mon, 28 May 2012 19:47:20 +0100 Subject: [PATCH] remove unecessary code --- packages/CLPBN/horus/BpSolver.cpp | 18 +++++------------- packages/CLPBN/horus/CbpSolver.cpp | 18 +++++------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/packages/CLPBN/horus/BpSolver.cpp b/packages/CLPBN/horus/BpSolver.cpp index 9af16d149..0e9a0782f 100644 --- a/packages/CLPBN/horus/BpSolver.cpp +++ b/packages/CLPBN/horus/BpSolver.cpp @@ -268,7 +268,7 @@ BpSolver::calcFactorToVarMsg (SpLink* link) for (size_t i = 0; i < links.size(); i++) { msgSize *= links[i]->varNode()->range(); } - unsigned repetitions = 1; + unsigned reps = 1; Params msgProduct (msgSize, LogAware::multIdenty()); if (Globals::logDomain) { for (size_t i = links.size(); i-- > 0; ) { @@ -277,16 +277,12 @@ BpSolver::calcFactorToVarMsg (SpLink* link) cout << " message from " << links[i]->varNode()->label(); cout << ": " ; } - Util::add (msgProduct, getVarToFactorMsg (links[i]), repetitions); - repetitions *= links[i]->varNode()->range(); + Util::add (msgProduct, getVarToFactorMsg (links[i]), reps); if (Constants::SHOW_BP_CALCS) { cout << endl; } - } else { - unsigned range = links[i]->varNode()->range(); - Util::add (msgProduct, Params (range, 0.0), repetitions); - repetitions *= range; } + reps *= links[i]->varNode()->range(); } } else { for (size_t i = links.size(); i-- > 0; ) { @@ -295,16 +291,12 @@ BpSolver::calcFactorToVarMsg (SpLink* link) cout << " message from " << links[i]->varNode()->label(); cout << ": " ; } - Util::multiply (msgProduct, getVarToFactorMsg (links[i]), repetitions); - repetitions *= links[i]->varNode()->range(); + Util::multiply (msgProduct, getVarToFactorMsg (links[i]), reps); if (Constants::SHOW_BP_CALCS) { cout << endl; } - } else { - unsigned range = links[i]->varNode()->range(); - Util::multiply (msgProduct, Params (range, 1.0), repetitions); - repetitions *= range; } + reps *= links[i]->varNode()->range(); } } Factor result (src->factor().arguments(), diff --git a/packages/CLPBN/horus/CbpSolver.cpp b/packages/CLPBN/horus/CbpSolver.cpp index 64f18f7aa..63c475d64 100644 --- a/packages/CLPBN/horus/CbpSolver.cpp +++ b/packages/CLPBN/horus/CbpSolver.cpp @@ -211,7 +211,7 @@ CbpSolver::calcFactorToVarMsg (SpLink* _link) for (size_t i = 0; i < links.size(); i++) { msgSize *= links[i]->varNode()->range(); } - unsigned repetitions = 1; + unsigned reps = 1; Params msgProduct (msgSize, LogAware::multIdenty()); if (Globals::logDomain) { for (size_t i = links.size(); i-- > 0; ) { @@ -221,16 +221,12 @@ CbpSolver::calcFactorToVarMsg (SpLink* _link) cout << " message from " << links[i]->varNode()->label(); cout << ": " ; } - Util::add (msgProduct, getVarToFactorMsg (links[i]), repetitions); - repetitions *= links[i]->varNode()->range(); + Util::add (msgProduct, getVarToFactorMsg (links[i]), reps); if (Constants::SHOW_BP_CALCS) { cout << endl; } - } else { - unsigned range = links[i]->varNode()->range(); - Util::add (msgProduct, Params (range, 0.0), repetitions); - repetitions *= range; } + reps *= links[i]->varNode()->range(); } } else { for (size_t i = links.size(); i-- > 0; ) { @@ -240,16 +236,12 @@ CbpSolver::calcFactorToVarMsg (SpLink* _link) cout << " message from " << links[i]->varNode()->label(); cout << ": " ; } - Util::multiply (msgProduct, getVarToFactorMsg (links[i]), repetitions); - repetitions *= links[i]->varNode()->range(); + Util::multiply (msgProduct, getVarToFactorMsg (links[i]), reps); if (Constants::SHOW_BP_CALCS) { cout << endl; } - } else { - unsigned range = links[i]->varNode()->range(); - Util::multiply (msgProduct, Params (range, 1.0), repetitions); - repetitions *= range; } + reps *= links[i]->varNode()->range(); } } Factor result (src->factor().arguments(),