gtsam
Loading...
Searching...
No Matches
gtsam::MultifrontalClique Class Reference

Detailed Description

Imperative multifrontal clique structure used by MultifrontalSolver.

Public Member Functions

 MultifrontalClique (std::vector< size_t > factorIndices, const std::weak_ptr< MultifrontalClique > &parent, const KeyVector &frontals, const KeySet &separatorKeys, const KeyDimMap &dims, size_t vbmRows, VectorValues *solution, const std::unordered_set< Key > *fixedKeys, size_t numEliminatedFrontals)
 Construct a clique from factor indices and cache static structure.
Setup (non-const)
void finalize (std::vector< ChildInfo > children, const MultifrontalParameters &params)
 Cache the children list, compute parent indices, and lock in QR usage.
void fillAb (const GaussianFactorGraph &graph)
 Load factor values into a lazily allocated, reusable Ab matrix.
void prepareForElimination ()
 Zero out the info matrix, re-add Hessians, accumulate Jacobians and children.
void factorize ()
 Perform Cholesky factorization on the frontal block.
void addIdentityDamping (double lambda)
 Add identity damping to the frontal block.
void addDiagonalDamping (double lambda, double minDiagonal, double maxDiagonal)
 Add diagonal damping to the frontal block.
void addExactDiagonalDamping (double lambda, const VectorValues &hessianDiagonal, double minDiagonal, double maxDiagonal)
 Add diagonal damping to the frontal block using an externally provided Hessian diagonal diag(J^T J) keyed by variable.
Read-only methods
int problemSize () const
 Return the clique dimension used for traversal scheduling.
size_t numFrontals () const
 Return the number of frontal keys in this clique.
bool fullyEliminated () const
 Return whether every symbolic frontal in this clique is eliminated.
const KeyVector & orderedKeys () const
 Return keys ordered by block index (frontals followed by separators).
std::shared_ptr< GaussianConditional > conditional () const
 Build a GaussianConditional from the in-place factorization.
std::shared_ptr< HessianFactor > remainingFactor () const
 Build the assembled factor on variables retained after partial elimination.
const VerticalBlockMatrix & Ab () const
 Get the vertical block matrix Ab.
const SymmetricBlockMatrix & info () const
 Get the information matrix (const).
bool useQR () const
 Check if this clique is using QR elimination.
bool useCompactCholesky () const
 Check if this leaf avoids materializing its separator Hessian.
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
 Print this clique.
Solve (non-const)
void eliminateInPlace ()
 Eliminate in-place, invalidating Ab_, and updating RSd_ and info_.
void eliminateInPlace (double lambda, const LMDampingParams &dampingParams, const VectorValues &exactHessianDiagonal)
 Version of eliminate that applies damping before eliminate.
void updateSolution ()
 Solve for this clique's frontal variables and write them back to the cached solution vectors.
double lastOldError () const
 Access the last old error computed during updateSolution().
double lastNewError () const
 Access the last new error computed during updateSolution().
double constantTermError () const
 Return the constant error term for this clique (nonzero for roots).

Public Attributes

std::weak_ptr< MultifrontalClique > parent
 Parent clique.
Children children
 Child cliques used for traversal.
size_t frontalDim = 0
 Frontal dimension.
size_t separatorDim = 0
 Separator dimension.

Public Types

using shared_ptr = std::shared_ptr<MultifrontalClique>
using Children = std::vector<shared_ptr>

Classes

struct  ChildInfo

Friends

std::ostream & operator<< (std::ostream &os, const MultifrontalClique &clique)

Constructor & Destructor Documentation

◆ MultifrontalClique()

gtsam::MultifrontalClique::MultifrontalClique ( std::vector< size_t > factorIndices,
const std::weak_ptr< MultifrontalClique > & parent,
const KeyVector & frontals,
const KeySet & separatorKeys,
const KeyDimMap & dims,
size_t vbmRows,
VectorValues * solution,
const std::unordered_set< Key > * fixedKeys,
size_t numEliminatedFrontals )
explicit

Construct a clique from factor indices and cache static structure.

Parameters
factorIndicesIndices of factors associated with this clique.
parentWeak pointer to the parent clique.
frontalsFrontal keys for this clique.
separatorKeysSeparator keys for this clique.
dimsKey->dimension map.
vbmRowsNumber of rows needed for the vertical block matrix.
solutionSolution storage for cached pointers.
fixedKeysKeys fixed to zero by constraints (may be null).

Member Function Documentation

◆ addDiagonalDamping()

void gtsam::MultifrontalClique::addDiagonalDamping ( double lambda,
double minDiagonal,
double maxDiagonal )

Add diagonal damping to the frontal block.

Parameters
lambdaDamping factor
minDiagonalMinimum diagonal value
maxDiagonalMaximum diagonal value

◆ addExactDiagonalDamping()

void gtsam::MultifrontalClique::addExactDiagonalDamping ( double lambda,
const VectorValues & hessianDiagonal,
double minDiagonal,
double maxDiagonal )

Add diagonal damping to the frontal block using an externally provided Hessian diagonal diag(J^T J) keyed by variable.

This matches the legacy LM diagonal damping definition based on the diagonal of the original linearized system rather than the post-Schur clique information matrix.

Parameters
lambdaDamping factor
hessianDiagonalMap from key to diagonal vector (dimension-matched).
minDiagonalMinimum diagonal value
maxDiagonalMaximum diagonal value

◆ addIdentityDamping()

void gtsam::MultifrontalClique::addIdentityDamping ( double lambda)

Add identity damping to the frontal block.

Parameters
lambdaDamping factor

◆ eliminateInPlace() [1/2]

void gtsam::MultifrontalClique::eliminateInPlace ( )

Eliminate in-place, invalidating Ab_, and updating RSd_ and info_.

Computes the local information matrix from the stacked Jacobian (Ab), incorporates child separator contributions, and performs partial QR or Cholesky on the frontal blocks.

◆ eliminateInPlace() [2/2]

void gtsam::MultifrontalClique::eliminateInPlace ( double lambda,
const LMDampingParams & dampingParams,
const VectorValues & exactHessianDiagonal )

Version of eliminate that applies damping before eliminate.

Parameters
lambdaOptional damping value; non-positive disables damping.
dampingParamsParameters controlling LM-style damping.
exactHessianDiagonaldiag(J^T J) values for diagonal damping.

◆ fillAb()

void gtsam::MultifrontalClique::fillAb ( const GaussianFactorGraph & graph)

Load factor values into a lazily allocated, reusable Ab matrix.

Parameters
graphThe factor graph with updated values (structure must match the graph used to build this clique, apart from updated numerical values). Only JacobianFactor and BatchJacobianFactor inputs are supported.

◆ finalize()

void gtsam::MultifrontalClique::finalize ( std::vector< ChildInfo > children,
const MultifrontalParameters & params )

Cache the children list, compute parent indices, and lock in QR usage.

Parameters
childrenChild cliques plus separator metadata.
paramsParameters controlling QR mode and thresholds.

◆ print()

void gtsam::MultifrontalClique::print ( const std::string & s = "",
const KeyFormatter & keyFormatter = DefaultKeyFormatter ) const

Print this clique.

Parameters
sOptional string prefix.
keyFormatterIgnored; retained for API compatibility.

◆ remainingFactor()

std::shared_ptr< HessianFactor > gtsam::MultifrontalClique::remainingFactor ( ) const

Build the assembled factor on variables retained after partial elimination.

The returned factor owns its information because it may outlive this clique. Consequently, exporting requires one copy of the active upper-triangular block. The clique must have been prepared, and any leading eliminated frontals must have been factorized.

◆ updateSolution()

void gtsam::MultifrontalClique::updateSolution ( )

Solve for this clique's frontal variables and write them back to the cached solution vectors.

Uses block back-substitution using the upper triangular-part of the Cholesky-stored information matrix, solving the triangular system for the frontal blocks.


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