Classes | Public Types | Static Public Member Functions | Static Protected Member Functions | List of all members
gtsam::BayesTreeMarginalizationHelper< BayesTree > Class Template Reference

#include <BayesTreeMarginalizationHelper.h>

Classes

struct  CachedSearch
 

Public Types

using Clique = typename BayesTree::Clique
 
using sharedClique = typename BayesTree::sharedClique
 

Static Public Member Functions

static std::unordered_set< KeygatherAdditionalKeysToReEliminate (const BayesTree &bayesTree, const KeyVector &marginalizableKeys)
 

Static Protected Member Functions

static void addCliqueToKeySet (const Clique *clique, std::unordered_set< Key > *additionalKeys)
 
static std::unordered_set< const Clique * > gatherAdditionalCliquesToReEliminate (const BayesTree &bayesTree, const KeyVector &marginalizableKeys)
 
static void gatherDependentCliques (const Clique *rootClique, const std::unordered_set< Key > &marginalizableKeys, std::unordered_set< const Clique * > *additionalCliques, CachedSearch *cache)
 
static void gatherDependentCliquesFromChildren (const std::vector< const Clique * > &dependentChildren, const std::unordered_set< Key > &marginalizableKeys, std::unordered_set< const Clique * > *additionalCliques, CachedSearch *cache)
 
static std::unordered_set< const Clique * > getCliquesContainingKeys (const BayesTree &bayesTree, const std::unordered_set< Key > &keysOfInterest)
 
static bool hasDependency (const Clique *clique, const std::unordered_set< Key > &keys)
 
static bool hasDependency (const Clique *clique, Key key)
 
static bool isWholeCliqueMarginalizable (const Clique *clique, const std::unordered_set< Key > &marginalizableKeys, CachedSearch *cache)
 
static bool isWholeSubtreeMarginalizable (const Clique *subtree, const std::unordered_set< Key > &marginalizableKeys, CachedSearch *cache)
 
static bool needsReelimination (const Clique *clique, const std::unordered_set< Key > &marginalizableKeys, CachedSearch *cache)
 

Detailed Description

template<typename BayesTree>
class gtsam::BayesTreeMarginalizationHelper< BayesTree >

This class provides helper functions for marginalizing variables from a Bayes Tree.

Definition at line 37 of file BayesTreeMarginalizationHelper.h.

Member Typedef Documentation

◆ Clique

template<typename BayesTree >
using gtsam::BayesTreeMarginalizationHelper< BayesTree >::Clique = typename BayesTree::Clique

Definition at line 40 of file BayesTreeMarginalizationHelper.h.

◆ sharedClique

template<typename BayesTree >
using gtsam::BayesTreeMarginalizationHelper< BayesTree >::sharedClique = typename BayesTree::sharedClique

Definition at line 41 of file BayesTreeMarginalizationHelper.h.

Member Function Documentation

◆ addCliqueToKeySet()

template<typename BayesTree >
static void gtsam::BayesTreeMarginalizationHelper< BayesTree >::addCliqueToKeySet ( const Clique clique,
std::unordered_set< Key > *  additionalKeys 
)
inlinestaticprotected

Add all frontal variables from a clique to a key set.

Parameters
[in]cliqueClique to add keys from
[out]additionalKeysPointer to the output key set

Definition at line 313 of file BayesTreeMarginalizationHelper.h.

◆ gatherAdditionalCliquesToReEliminate()

template<typename BayesTree >
static std::unordered_set<const Clique*> gtsam::BayesTreeMarginalizationHelper< BayesTree >::gatherAdditionalCliquesToReEliminate ( const BayesTree bayesTree,
const KeyVector marginalizableKeys 
)
inlinestaticprotected

This function identifies cliques that need to be re-eliminated before performing marginalization. See the docstring of gatherAdditionalKeysToReEliminate().

Definition at line 98 of file BayesTreeMarginalizationHelper.h.

◆ gatherAdditionalKeysToReEliminate()

template<typename BayesTree >
static std::unordered_set<Key> gtsam::BayesTreeMarginalizationHelper< BayesTree >::gatherAdditionalKeysToReEliminate ( const BayesTree bayesTree,
const KeyVector marginalizableKeys 
)
inlinestatic

This function identifies variables that need to be re-eliminated before performing marginalization.

Re-elimination is necessary for a clique containing marginalizable variables if:

  1. Some non-marginalizable variables appear before marginalizable ones in that clique;
  2. 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]bayesTreeThe Bayes tree
[in]marginalizableKeysKeys to be marginalized
Returns
Set of additional keys that need to be re-eliminated

Definition at line 67 of file BayesTreeMarginalizationHelper.h.

◆ gatherDependentCliques()

template<typename BayesTree >
static void gtsam::BayesTreeMarginalizationHelper< BayesTree >::gatherDependentCliques ( const Clique rootClique,
const std::unordered_set< Key > &  marginalizableKeys,
std::unordered_set< const Clique * > *  additionalCliques,
CachedSearch cache 
)
inlinestaticprotected

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.

Parameters
[in]rootCliqueThe root clique
[in]marginalizableKeysSet of keys to be marginalized

Definition at line 252 of file BayesTreeMarginalizationHelper.h.

◆ gatherDependentCliquesFromChildren()

template<typename BayesTree >
static void gtsam::BayesTreeMarginalizationHelper< BayesTree >::gatherDependentCliquesFromChildren ( const std::vector< const Clique * > &  dependentChildren,
const std::unordered_set< Key > &  marginalizableKeys,
std::unordered_set< const Clique * > *  additionalCliques,
CachedSearch cache 
)
inlinestaticprotected

A helper function for the above gatherDependentCliques().

Definition at line 277 of file BayesTreeMarginalizationHelper.h.

◆ getCliquesContainingKeys()

template<typename BayesTree >
static std::unordered_set<const Clique*> gtsam::BayesTreeMarginalizationHelper< BayesTree >::getCliquesContainingKeys ( const BayesTree bayesTree,
const std::unordered_set< Key > &  keysOfInterest 
)
inlinestaticprotected

Gather the cliques containing any of the given keys.

Parameters
[in]bayesTreeThe Bayes tree
[in]keysOfInterestSet of keys of interest
Returns
Set of cliques that contain any of the given keys

Definition at line 135 of file BayesTreeMarginalizationHelper.h.

◆ hasDependency() [1/2]

template<typename BayesTree >
static bool gtsam::BayesTreeMarginalizationHelper< BayesTree >::hasDependency ( const Clique clique,
const std::unordered_set< Key > &  keys 
)
inlinestaticprotected

Check if the clique depends on any of the given keys.

Definition at line 343 of file BayesTreeMarginalizationHelper.h.

◆ hasDependency() [2/2]

template<typename BayesTree >
static bool gtsam::BayesTreeMarginalizationHelper< BayesTree >::hasDependency ( const Clique clique,
Key  key 
)
inlinestaticprotected

Check if the clique depends on the given key.

Parameters
[in]cliqueClique to check
[in]keyKey to check for dependencies
Returns
true if clique depends on the key

Definition at line 328 of file BayesTreeMarginalizationHelper.h.

◆ isWholeCliqueMarginalizable()

template<typename BayesTree >
static bool gtsam::BayesTreeMarginalizationHelper< BayesTree >::isWholeCliqueMarginalizable ( const Clique clique,
const std::unordered_set< Key > &  marginalizableKeys,
CachedSearch cache 
)
inlinestaticprotected

Check if all variables in the clique are marginalizable.

Note we use a cache map to avoid repeated searches.

Definition at line 158 of file BayesTreeMarginalizationHelper.h.

◆ isWholeSubtreeMarginalizable()

template<typename BayesTree >
static bool gtsam::BayesTreeMarginalizationHelper< BayesTree >::isWholeSubtreeMarginalizable ( const Clique subtree,
const std::unordered_set< Key > &  marginalizableKeys,
CachedSearch cache 
)
inlinestaticprotected

Check if all variables in the subtree are marginalizable.

Note we use a cache map to avoid repeated searches.

Definition at line 183 of file BayesTreeMarginalizationHelper.h.

◆ needsReelimination()

template<typename BayesTree >
static bool gtsam::BayesTreeMarginalizationHelper< BayesTree >::needsReelimination ( const Clique clique,
const std::unordered_set< Key > &  marginalizableKeys,
CachedSearch cache 
)
inlinestaticprotected

Check if a clique contains variables that need reelimination due to elimination ordering conflicts.

Parameters
[in]cliqueThe clique to check
[in]marginalizableKeysSet of keys to be marginalized
Returns
true if any variables in the clique need re-elimination

Definition at line 215 of file BayesTreeMarginalizationHelper.h.


The documentation for this class was generated from the following file:


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:23:31