From 878eeb5d73d598904dcf7bb578bf6756fc8b71ba Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 31 Dec 2022 12:33:37 +0100 Subject: [PATCH] simplify the error addition --- gtsam/hybrid/HybridGaussianFactorGraph.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/gtsam/hybrid/HybridGaussianFactorGraph.cpp b/gtsam/hybrid/HybridGaussianFactorGraph.cpp index b35728f14..2170e7b68 100644 --- a/gtsam/hybrid/HybridGaussianFactorGraph.cpp +++ b/gtsam/hybrid/HybridGaussianFactorGraph.cpp @@ -235,7 +235,7 @@ hybridElimination(const HybridGaussianFactorGraph &factors, gttoc_(hybrid_eliminate); #endif - //TODO(Varun) The normalizing constant has to be computed correctly + // TODO(Varun) The normalizing constant has to be computed correctly return {conditional_factor.first, {conditional_factor.second, 0.0}}; }; @@ -461,15 +461,8 @@ AlgebraicDecisionTree HybridGaussianFactorGraph::error( // If factor is hybrid, select based on assignment. GaussianMixtureFactor::shared_ptr gaussianMixture = boost::static_pointer_cast(factors_.at(idx)); - // Compute factor error. - factor_error = gaussianMixture->error(continuousValues); - - // If first factor, assign error, else add it. - if (idx == 0) { - error_tree = factor_error; - } else { - error_tree = error_tree + factor_error; - } + // Compute factor error and add it. + error_tree = error_tree + gaussianMixture->error(continuousValues); } else if (factors_.at(idx)->isContinuous()) { // If continuous only, get the (double) error