gtsam 4.1.1
gtsam
|
This is the base class for BayesTree cliques.
The default and standard derived type is BayesTreeClique, but some algorithms, like iSAM2, use a different clique type in order to store extra data along with the clique.
This class is templated on the derived class (i.e. the curiously recursive template pattern). The advantage of this over using virtual classes is that it avoids the need for casting to get the derived type. This is possible because all cliques in a BayesTree are the same type - if they were not then we'd need a virtual class.
DERIVED | The derived clique type. |
CONDITIONAL | The conditional type. |
Advanced Interface | |
class | BayesTree< DerivedType > |
class | boost::serialization::access |
Serialization function. | |
KeyVector | separator_setminus_B (const derived_ptr &B) const |
Calculate set \( S \setminus B \) for shortcut calculations. | |
KeyVector | shortcut_indices (const derived_ptr &B, const FactorGraphType &p_Cp_B) const |
Determine variable indices to keep in recursive separator shortcut calculation The factor graph p_Cp_B has keys from the parent clique Cp and from B. More... | |
void | deleteCachedShortcutsNonRecursive () |
Non-recursive delete cached shortcuts and marginals - internal only. | |
BayesNetType | shortcut (const derived_ptr &root, Eliminate function=EliminationTraitsType::DefaultEliminate) const |
return the conditional P(S|Root) on the separator given the root | |
FactorGraphType | separatorMarginal (Eliminate function=EliminationTraitsType::DefaultEliminate) const |
return the marginal P(S) on the separator | |
FactorGraphType | marginal2 (Eliminate function=EliminationTraitsType::DefaultEliminate) const |
return the marginal P(C) of the clique, using marginal caching | |
void | deleteCachedShortcuts () |
This deletes the cached shortcuts of all cliques (subtree) below this clique. More... | |
const boost::optional< FactorGraphType > & | cachedSeparatorMarginal () const |
Standard Constructors | |
BayesTreeCliqueBase () | |
Default constructor. | |
BayesTreeCliqueBase (const sharedConditional &conditional) | |
Construct from a conditional, leaving parent and child pointers uninitialized. | |
BayesTreeCliqueBase (const BayesTreeCliqueBase &c) | |
Shallow copy constructor. | |
BayesTreeCliqueBase & | operator= (const BayesTreeCliqueBase &c) |
Shallow copy assignment constructor. | |
virtual | ~BayesTreeCliqueBase () |
Testable | |
bool | equals (const DERIVED &other, double tol=1e-9) const |
check equality | |
virtual void | print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const |
print this node More... | |
Public Member Functions | |
void | setEliminationResult (const typename FactorGraphType::EliminationResult &eliminationResult) |
Fill the elimination result produced during elimination. More... | |
Public Attributes | |
sharedConditional | conditional_ |
derived_weak_ptr | parent_ |
FastVector< derived_ptr > | children |
int | problemSize_ |
bool | is_root = false |
Protected Attributes | |
boost::optional< FactorGraphType > | cachedSeparatorMarginal_ |
This stores the Cached separator marginal P(S) | |
std::mutex | cachedSeparatorMarginalMutex_ |
This protects Cached seperator marginal P(S) from concurrent read/writes as many the functions which access it are const (hence the mutable) leading to the false impression that these const functions are thread-safe which is not true due to these mutable values. More... | |
void gtsam::BayesTreeCliqueBase< DERIVED, FACTORGRAPH >::deleteCachedShortcuts |
This deletes the cached shortcuts of all cliques (subtree) below this clique.
This is performed when the bayes tree is modified.
|
virtual |
print this node
Reimplemented in gtsam::ISAM2Clique.
void gtsam::BayesTreeCliqueBase< DERIVED, FACTORGRAPH >::setEliminationResult | ( | const typename FactorGraphType::EliminationResult & | eliminationResult | ) |
Fill the elimination result produced during elimination.
Here this just stores the conditional and ignores the remaining factor, but this is overridden in ISAM2Clique to also cache the remaining factor.
|
protected |
Determine variable indices to keep in recursive separator shortcut calculation The factor graph p_Cp_B has keys from the parent clique Cp and from B.
But we only keep the variables not in S union B.
|
mutableprotected |
This protects Cached seperator marginal P(S) from concurrent read/writes as many the functions which access it are const (hence the mutable) leading to the false impression that these const functions are thread-safe which is not true due to these mutable values.
This is fixed by applying this mutex.