time dead mode removal

release/4.3a0
Varun Agrawal 2025-01-28 02:47:49 -05:00
parent cbf8bc2f7c
commit bee756e9bf
1 changed files with 8 additions and 0 deletions

View File

@ -72,6 +72,10 @@ HybridBayesNet HybridBayesNet::prune(
// If we have a dead mode threshold and discrete variables left after pruning,
// then we run dead mode removal.
if (deadModeThreshold.has_value() && pruned.keys().size() > 0) {
#if GTSAM_HYBRID_TIMING
gttic_(DeadModeRemoval);
#endif
DiscreteMarginals marginals(DiscreteFactorGraph{pruned});
for (auto dkey : pruned.discreteKeys()) {
Vector probabilities = marginals.marginalProbabilities(dkey);
@ -108,6 +112,10 @@ HybridBayesNet HybridBayesNet::prune(
std::dynamic_pointer_cast<DiscreteConditional>(marginals(key)));
}
#if GTSAM_HYBRID_TIMING
gttoc_(DeadModeRemoval);
#endif
} else {
result.emplace_shared<DiscreteConditional>(pruned);
}