template<typename
BayesTree>
class gtsam::BayesTreeMarginalizationHelper< BayesTree >
This class provides helper functions for marginalizing variables from a Bayes Tree.
|
| static std::unordered_set< const Clique * > | gatherAdditionalCliquesToReEliminate (const BayesTree &bayesTree, const KeyVector &marginalizableKeys) |
| | This function identifies cliques that need to be re-eliminated before performing marginalization.
|
| static std::unordered_set< const Clique * > | getCliquesContainingKeys (const BayesTree &bayesTree, const std::unordered_set< Key > &keysOfInterest) |
| | Gather the cliques containing any of the given keys.
|
| static bool | isWholeCliqueMarginalizable (const Clique *clique, const std::unordered_set< Key > &marginalizableKeys, CachedSearch *cache) |
| | Check if all variables in the clique are marginalizable.
|
| static bool | isWholeSubtreeMarginalizable (const Clique *subtree, const std::unordered_set< Key > &marginalizableKeys, CachedSearch *cache) |
| | Check if all variables in the subtree are marginalizable.
|
| static bool | needsReelimination (const Clique *clique, const std::unordered_set< Key > &marginalizableKeys, CachedSearch *cache) |
| | Check if a clique contains variables that need reelimination due to elimination ordering conflicts.
|
| static void | gatherDependentCliques (const Clique *rootClique, const std::unordered_set< Key > &marginalizableKeys, std::unordered_set< const Clique * > *additionalCliques, CachedSearch *cache) |
| | Gather all dependent nodes that lie on a path from the root clique to a clique containing a non-marginalizable variable at the leaf side.
|
|
static void | gatherDependentCliquesFromChildren (const std::vector< const Clique * > &dependentChildren, const std::unordered_set< Key > &marginalizableKeys, std::unordered_set< const Clique * > *additionalCliques, CachedSearch *cache) |
| | A helper function for the above gatherDependentCliques().
|
| static void | addCliqueToKeySet (const Clique *clique, std::unordered_set< Key > *additionalKeys) |
| | Add all frontal variables from a clique to a key set.
|
| static bool | hasDependency (const Clique *clique, Key key) |
| | Check if the clique depends on the given key.
|
|
static bool | hasDependency (const Clique *clique, const std::unordered_set< Key > &keys) |
| | Check if the clique depends on any of the given keys.
|
This function identifies variables that need to be re-eliminated before performing marginalization.
Re-elimination is necessary for a clique containing marginalizable variables if:
- Some non-marginalizable variables appear before marginalizable ones in that clique;
- Or it has a child node depending on a marginalizable variable AND the subtree rooted at that child contains non-marginalizables.
In addition, for any descendant node depending on a marginalizable variable, if the subtree rooted at that descendant contains non-marginalizable variables (i.e., it lies on a path from one of the aforementioned cliques that require re-elimination to a node containing non-marginalizable variables at the leaf side), then it also needs to be re-eliminated.
- Parameters
-
| [in] | bayesTree | The Bayes tree |
| [in] | marginalizableKeys | Keys to be marginalized |
- Returns
- Set of additional keys that need to be re-eliminated