From 5bb1564a7408f2f73629a3d78a3b609d280882e7 Mon Sep 17 00:00:00 2001 From: Can Erdogan Date: Sun, 4 Mar 2012 01:36:09 +0000 Subject: [PATCH] eliminateOne returns empty graph if the "new" factor is empty. --- gtsam/inference/inference-inl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gtsam/inference/inference-inl.h b/gtsam/inference/inference-inl.h index cf7e13f01..02e78e8e9 100644 --- a/gtsam/inference/inference-inl.h +++ b/gtsam/inference/inference-inl.h @@ -104,8 +104,9 @@ typename Graph::FactorizationResult eliminate(const Graph& factorGraph, const st remainingGraph.push_back(factorGraph[i]); } - // Add remaining factor - remainingGraph.push_back(remainingFactor); + // Add the remaining factor if it is not empty. + if(remainingFactor->size() != 0) + remainingGraph.push_back(remainingFactor); return typename Graph::FactorizationResult(conditional, remainingGraph);