From fbe893eb2cd238f9a83afb39b08db6b459f38531 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 12 Mar 2025 17:54:14 -0400 Subject: [PATCH] more functional form of involved function --- gtsam/hybrid/HybridSmoother.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gtsam/hybrid/HybridSmoother.cpp b/gtsam/hybrid/HybridSmoother.cpp index 7b8c3faf1..b0fbb35c9 100644 --- a/gtsam/hybrid/HybridSmoother.cpp +++ b/gtsam/hybrid/HybridSmoother.cpp @@ -171,7 +171,7 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &newFactors, HybridBayesNet updatedHybridBayesNet(hybridBayesNet); KeySet involvedKeys = newFactors.keys(); - auto involved = [&involvedKeys](const Key &key) { + auto involved = [](const KeySet &involvedKeys, const Key &key) { return involvedKeys.find(key) != involvedKeys.end(); }; @@ -195,7 +195,7 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &newFactors, auto conditional = hybridBayesNet.at(i); for (auto &key : conditional->frontals()) { - if (involved(key)) { + if (involved(involvedKeys, key)) { // Add the conditional parents to involvedKeys // so we add those conditionals too. for (auto &&parentKey : conditional->parents()) { @@ -214,7 +214,7 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &newFactors, auto conditional = hybridBayesNet.at(i); for (auto &key : conditional->frontals()) { - if (involved(key)) { + if (involved(involvedKeys, key)) { newConditionals.push_back(conditional); // Remove the conditional from the updated Bayes net