|
gtsam
|
Imperative-style multifrontal solver for Gaussian factor graphs.
This class precomputes the elimination tree, allocates fixed solve storage, and provides efficient methods for loading new factors, eliminating the graph, and solving for the update vector. Each clique lazily allocates its packed Jacobian fallback rows on the first compatible load and reuses that storage thereafter.
Public Member Functions | |
| MultifrontalSolver (const GaussianFactorGraph &graph, const Ordering &ordering, const Parameters ¶ms=Parameters{}) | |
| Construct the solver from a factor graph and an ordering. | |
| MultifrontalSolver (const GaussianFactorGraph &graph, const Ordering &ordering, size_t firstPhaseSize, const Parameters ¶ms=Parameters{}) | |
| Construct a solver configured for partial multifrontal elimination. | |
| MultifrontalSolver (PrecomputedData data, const Ordering &ordering, const Parameters ¶ms=Parameters{}) | |
| Construct the solver from precomputed symbolic data. | |
| MultifrontalSolver (PrecomputedData data, const Ordering &ordering, size_t firstPhaseSize, const Parameters ¶ms=Parameters{}) | |
| Construct a partial solver from precomputed symbolic data. | |
| void | load (const GaussianFactorGraph &graph) |
| Load new numerical values from the factor graph. | |
| void | eliminateInPlace () |
| Eliminate the graph using Cholesky factorization. | |
| void | eliminateInPlace (const GaussianFactorGraph &graph) |
| Load and eliminate the graph in a single traversal. | |
| void | eliminatePartialInPlace () |
| Eliminate the configured ordering prefix and assemble the retained clique factors without factorizing the retained variables. | |
| void | eliminatePartialInPlace (const GaussianFactorGraph &graph) |
| Load a graph and partially eliminate it in one bottom-up traversal. | |
| GaussianFactorGraph | remainingFactorGraph () const |
| Materialize one Hessian factor per retained clique after partial elimination. | |
| GaussianBayesTree | computeBayesTree () const |
| Compute a Bayes tree from the in-place Cholesky factorization. | |
| const VectorValues & | updateSolution () |
| Solve for the update vector. | |
| const VectorValues & | updateSolution (const VectorValues &retainedSolution) |
| Seed retained variables and back-substitute through eliminated cliques. | |
| double | deltaError (double *oldError=nullptr, double *newError=nullptr) const |
| Return the linearized delta error from the last updateSolution() call. | |
| const std::vector< CliquePtr > & | roots () const |
| Accessor for the roots of the elimination tree. | |
| size_t | cliqueCount () const |
| Get the total number of cliques in the solver. | |
| void | print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const |
| Print the solver state. | |
| Public Member Functions inherited from gtsam::ForestTraversal< MultifrontalSolver, MultifrontalClique > | |
| ForestTraversal (size_t numThreads=std::thread::hardware_concurrency()) | |
| Construct a helper with a fixed thread budget (used by TBB when enabled). | |
| void | runTopDown (Fn fn, int parallelThreshold=10) |
| Scheduler-based top-down traversal. | |
| void | runBottomUp (Fn fn, int parallelThreshold=10, size_t leafAggregationProblemSize=0) |
| Scheduler-based bottom-up traversal. | |
Static Public Member Functions | |
| static PrecomputedData | Precompute (const GaussianFactorGraph &graph, const Ordering &ordering) |
| Precompute symbolic structure and sizing data from a factor graph. | |
Public Types | |
| using | Parameters = MultifrontalParameters |
| Tuning parameters for traversal and reporting. | |
| using | CliquePtr = std::shared_ptr<MultifrontalClique> |
| Shared pointer to a MultifrontalClique. | |
| using | Node = MultifrontalClique |
| Node type for tree traversal utilities. | |
Classes | |
| struct | PrecomputedData |
| Precomputed symbolic and sizing data for multifrontal solver construction. More... | |
Protected Attributes | |
| std::vector< CliquePtr > | roots_ |
| Roots of the elimination tree. | |
| std::vector< CliquePtr > | cliques_ |
| All cliques in the solver. | |
| std::map< Key, size_t > | dims_ |
| Map from variable key to dimension. | |
| VectorValues | solution_ |
| Cached solution vector. | |
| std::unordered_set< Key > | fixedKeys_ |
| Keys fixed by constrained factors. | |
| bool | loaded_ = false |
| Whether load() has been called. | |
| bool | eliminated_ = false |
| Whether eliminateInPlace() ran. | |
| bool | partiallyEliminated_ = false |
| Whether partial elimination ran. | |
| Ordering | ordering_ |
| Complete variable ordering. | |
| size_t | firstPhaseSize_ = 0 |
| Prefix eliminated in partial mode. | |
| Parameters | params_ |
| Tunable solver parameters. | |
| double | lastOldError_ = 0.0 |
| Cached old linearized error. | |
| double | lastNewError_ = 0.0 |
| Cached new linearized error. | |
| bool | hasDeltaError_ = false |
| Whether updateSolution computed it. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const MultifrontalSolver &solver) |
| Output stream operator for MultifrontalSolver. | |
| gtsam::MultifrontalSolver::MultifrontalSolver | ( | const GaussianFactorGraph & | graph, |
| const Ordering & | ordering, | ||
| const Parameters & | params = Parameters{} ) |
Construct the solver from a factor graph and an ordering.
This builds the indexed junction tree and allocates fixed solve matrices. Packed Jacobian fallback storage is allocated lazily during the first load. Call load() before eliminating to populate numerical values.
| graph | The factor graph to solve. Must contain only JacobianFactor or BatchJacobianFactor instances. |
| ordering | The variable ordering to use for elimination. |
| params | Tunable parameters for traversal and reporting. |
| gtsam::MultifrontalSolver::MultifrontalSolver | ( | const GaussianFactorGraph & | graph, |
| const Ordering & | ordering, | ||
| size_t | firstPhaseSize, | ||
| const Parameters & | params = Parameters{} ) |
Construct a solver configured for partial multifrontal elimination.
The leading firstPhaseSize keys in ordering are eliminated, while the remaining keys stay assembled in retained clique factors.
| gtsam::MultifrontalSolver::MultifrontalSolver | ( | PrecomputedData | data, |
| const Ordering & | ordering, | ||
| const Parameters & | params = Parameters{} ) |
Construct the solver from precomputed symbolic data.
Call load() before eliminating to populate numerical values.
| data | Precomputed symbolic structure and sizing data. |
| ordering | The variable ordering to use for seeding solution storage. |
| params | Tunable parameters for traversal and reporting. |
| GaussianBayesTree gtsam::MultifrontalSolver::computeBayesTree | ( | ) | const |
Compute a Bayes tree from the in-place Cholesky factorization.
Requires eliminateInPlace() to have been called beforehand.
| double gtsam::MultifrontalSolver::deltaError | ( | double * | oldError = nullptr, |
| double * | newError = nullptr ) const |
Return the linearized delta error from the last updateSolution() call.
Optionally returns the old and new linearized errors.
| void gtsam::MultifrontalSolver::eliminateInPlace | ( | ) |
Eliminate the graph using Cholesky factorization.
This operates in-place on the clique's reusable numerical storage.
| void gtsam::MultifrontalSolver::eliminateInPlace | ( | const GaussianFactorGraph & | graph | ) |
Load and eliminate the graph in a single traversal.
This calls fillAb() and eliminateInPlace() per clique in post-order.
| void gtsam::MultifrontalSolver::load | ( | const GaussianFactorGraph & | graph | ) |
Load new numerical values from the factor graph.
The first load builds cached factor load plans and allocates only the Jacobian rows needed by the selected numerical path. Later compatible loads overwrite and reuse that packed storage.
| graph | The factor graph with updated values (structure must match the graph used to construct/precompute this solver, apart from updated numerical values). |
|
static |
Precompute symbolic structure and sizing data from a factor graph.
This builds an IndexedJunctionTree that can be reused across multiple solver instances when the graph structure and ordering remain unchanged. Only JacobianFactor and BatchJacobianFactor inputs are supported.
| graph | The factor graph (must contain only supported Jacobian-style factor instances) |
| ordering | The variable elimination ordering |
| GaussianFactorGraph gtsam::MultifrontalSolver::remainingFactorGraph | ( | ) | const |
Materialize one Hessian factor per retained clique after partial elimination.
Each returned factor owns a compact copy of its active upper-triangular information block because it may outlive the clique.
| const VectorValues & gtsam::MultifrontalSolver::updateSolution | ( | ) |
Solve for the update vector.