From c550139c8bd89e71348ffd932ae423313a6bb95e Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Mon, 18 Mar 2013 15:57:10 +0000 Subject: [PATCH] Add more assertations to Factor class. SumOutFirstVariable and SumOutLastVariable will only are correctly defined if the variable is binary. --- packages/CLPBN/horus/Factor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/CLPBN/horus/Factor.cpp b/packages/CLPBN/horus/Factor.cpp index ed258c2c6..e22317617 100644 --- a/packages/CLPBN/horus/Factor.cpp +++ b/packages/CLPBN/horus/Factor.cpp @@ -149,6 +149,7 @@ Factor::print() const void Factor::sumOutFirstVariable() { + assert (ranges_.size() == 2); size_t sep = params_.size() / 2; if (Globals::logDomain) { std::transform ( @@ -172,6 +173,7 @@ Factor::sumOutFirstVariable() void Factor::sumOutLastVariable() { + assert (ranges_.size() == 2); Params::iterator first1 = params_.begin(); Params::iterator first2 = params_.begin(); Params::iterator last = params_.end();