GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
gtsam::ISAM2Clique Class Reference

#include <ISAM2Clique.h>

Inheritance diagram for gtsam::ISAM2Clique:
Inheritance graph
[legend]
Collaboration diagram for gtsam::ISAM2Clique:
Collaboration graph
[legend]

Public Types

typedef ISAM2Clique This
 
typedef BayesTreeCliqueBase< This, GaussianFactorGraphBase
 
typedef std::shared_ptr< Thisshared_ptr
 
typedef std::weak_ptr< Thisweak_ptr
 
typedef GaussianConditional ConditionalType
 
typedef ConditionalType::shared_ptr sharedConditional
 
typedef GaussianFactorGraph FactorGraphType
 
typedef EliminationTraitsType::BayesNetType BayesNetType
 
typedef FactorGraphType::FactorType FactorType
 
typedef FactorGraphType::Eliminate Eliminate
 

Public Member Functions

 ISAM2Clique ()
 Default constructor.
 
 ISAM2Clique (const ISAM2Clique &other)
 
ISAM2Cliqueoperator= (const ISAM2Clique &other)
 
void setEliminationResult (const FactorGraphType::EliminationResult &eliminationResult)
 Overridden to also store the remaining factor and gradient contribution.
 
Base::FactorType::shared_ptr & cachedFactor ()
 
const Vector & gradientContribution () const
 Access the gradient contribution.
 
void addGradientAtZero (VectorValues *g) const
 Recursively add gradient at zero to g.
 
bool equals (const This &other, double tol=1e-9) const
 
void print (const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override
 
void optimizeWildfire (const KeySet &replaced, double threshold, KeySet *changed, VectorValues *delta, size_t *count) const
 
bool optimizeWildfireNode (const KeySet &replaced, double threshold, KeySet *changed, VectorValues *delta, size_t *count) const
 
void nnz_internal (size_t *result) const
 
size_t calculate_nnz () const
 
void findAll (const KeySet &markedMask, KeySet *keys) const
 
void setEliminationResult (const typename FactorGraphType::EliminationResult &eliminationResult)
 
Standard Interface
const sharedConditional & conditional () const
 
bool isRoot () const
 
size_t treeSize () const
 
size_t numCachedSeparatorMarginals () const
 
derived_ptr parent () const
 
int problemSize () const
 

Public Attributes

Base::FactorType::shared_ptr cachedFactor_
 
Vector gradientContribution_
 
sharedConditional conditional_
 
derived_weak_ptr parent_
 
FastVector< derived_ptr > children
 
int problemSize_
 
bool is_root
 

Protected Attributes

std::optional< FactorGraphTypecachedSeparatorMarginal_
 This stores the Cached separator marginal P(S)
 
std::mutex cachedSeparatorMarginalMutex_
 

Advanced Interface

BayesNetType shortcut (const derived_ptr &root, Eliminate function=EliminationTraitsType::DefaultEliminate) const
 
FactorGraphType separatorMarginal (Eliminate function=EliminationTraitsType::DefaultEliminate) const
 
FactorGraphType marginal2 (Eliminate function=EliminationTraitsType::DefaultEliminate) const
 
void deleteCachedShortcuts ()
 
const std::optional< FactorGraphType > & cachedSeparatorMarginal () const
 
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
 
void deleteCachedShortcutsNonRecursive ()
 

Detailed Description

Specialized Clique structure for ISAM2, incorporating caching and gradient contribution TODO: more documentation

Constructor & Destructor Documentation

◆ ISAM2Clique()

gtsam::ISAM2Clique::ISAM2Clique ( const ISAM2Clique other)
inline

Copy constructor, does not copy solution pointers as these are invalid in different trees.

Member Function Documentation

◆ cachedFactor()

Base::FactorType::shared_ptr& gtsam::ISAM2Clique::cachedFactor ( )
inline

Access the cached factor

◆ conditional()

const sharedConditional& gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::conditional ( ) const
inlineinherited

Access the conditional

◆ deleteCachedShortcuts()

void gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::deleteCachedShortcuts ( )
inherited

This deletes the cached shortcuts of all cliques (subtree) below this clique. This is performed when the bayes tree is modified.

◆ deleteCachedShortcutsNonRecursive()

void gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::deleteCachedShortcutsNonRecursive ( )
inlineprotectedinherited

Non-recursive delete cached shortcuts and marginals - internal only.

◆ findAll()

void gtsam::ISAM2Clique::findAll ( const KeySet markedMask,
KeySet keys 
) const

Recursively search this clique and its children for marked keys appearing in the separator, and add the frontal keys of any cliques whose separator contains any marked keys to the set keys. The purpose of this is to discover the cliques that need to be redone due to information propagating to them from cliques that directly contain factors being relinearized.

The original comment says this finds all variables directly connected to the marked ones by measurements. Is this true, because it seems like this would also pull in variables indirectly connected through other frontal or separator variables?

Alternatively could we trace up towards the root for each variable here?

◆ isRoot()

bool gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::isRoot ( ) const
inlineinherited

is this the root of a Bayes tree ?

◆ marginal2()

BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::FactorGraphType gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::marginal2 ( Eliminate  function = EliminationTraitsType::DefaultEliminate) const
inherited

return the marginal P(C) of the clique, using marginal caching

◆ nnz_internal()

void gtsam::ISAM2Clique::nnz_internal ( size_t *  result) const

Starting from the root, add up entries of frontal and conditional matrices of each conditional

◆ numCachedSeparatorMarginals()

size_t gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::numCachedSeparatorMarginals ( ) const
inherited

Collect number of cliques with cached separator marginals

◆ operator=()

ISAM2Clique& gtsam::ISAM2Clique::operator= ( const ISAM2Clique other)
inline

Assignment operator, does not copy solution pointers as these are invalid in different trees.

◆ parent()

derived_ptr gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::parent ( ) const
inlineinherited

return a shared_ptr to the parent clique

◆ print()

void gtsam::ISAM2Clique::print ( const std::string &  s = "",
const KeyFormatter formatter = DefaultKeyFormatter 
) const
overridevirtual

◆ problemSize()

int gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::problemSize ( ) const
inlineinherited

Problem size (used for parallel traversal)

◆ separatorMarginal()

BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::FactorGraphType gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::separatorMarginal ( Eliminate  function = EliminationTraitsType::DefaultEliminate) const
inherited

return the marginal P(S) on the separator

◆ setEliminationResult()

void gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::setEliminationResult ( const typename FactorGraphType::EliminationResult eliminationResult)
inherited

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.

◆ shortcut()

BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::BayesNetType gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::shortcut ( const derived_ptr &  root,
Eliminate  function = EliminationTraitsType::DefaultEliminate 
) const
inherited

return the conditional P(S|Root) on the separator given the root

◆ shortcut_indices()

KeyVector gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::shortcut_indices ( const derived_ptr &  B,
const FactorGraphType p_Cp_B 
) const
protectedinherited

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.

◆ treeSize()

size_t gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::treeSize ( ) const
inherited

The size of subtree rooted at this clique, i.e., nr of Cliques

Member Data Documentation

◆ cachedSeparatorMarginalMutex_

std::mutex gtsam::BayesTreeCliqueBase< ISAM2Clique , GaussianFactorGraph >::cachedSeparatorMarginalMutex_
mutableprotectedinherited

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.


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