more functional form of involved function

release/4.3a0
Varun Agrawal 2025-03-12 17:54:14 -04:00
parent d48740fa22
commit fbe893eb2c
1 changed files with 3 additions and 3 deletions

View File

@ -171,7 +171,7 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &newFactors,
HybridBayesNet updatedHybridBayesNet(hybridBayesNet); HybridBayesNet updatedHybridBayesNet(hybridBayesNet);
KeySet involvedKeys = newFactors.keys(); KeySet involvedKeys = newFactors.keys();
auto involved = [&involvedKeys](const Key &key) { auto involved = [](const KeySet &involvedKeys, const Key &key) {
return involvedKeys.find(key) != involvedKeys.end(); return involvedKeys.find(key) != involvedKeys.end();
}; };
@ -195,7 +195,7 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &newFactors,
auto conditional = hybridBayesNet.at(i); auto conditional = hybridBayesNet.at(i);
for (auto &key : conditional->frontals()) { for (auto &key : conditional->frontals()) {
if (involved(key)) { if (involved(involvedKeys, key)) {
// Add the conditional parents to involvedKeys // Add the conditional parents to involvedKeys
// so we add those conditionals too. // so we add those conditionals too.
for (auto &&parentKey : conditional->parents()) { for (auto &&parentKey : conditional->parents()) {
@ -214,7 +214,7 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &newFactors,
auto conditional = hybridBayesNet.at(i); auto conditional = hybridBayesNet.at(i);
for (auto &key : conditional->frontals()) { for (auto &key : conditional->frontals()) {
if (involved(key)) { if (involved(involvedKeys, key)) {
newConditionals.push_back(conditional); newConditionals.push_back(conditional);
// Remove the conditional from the updated Bayes net // Remove the conditional from the updated Bayes net