24 for (
const Key key : keys) {
25 std::vector<NonlinearFactor::shared_ptr>
factors;
26 for (
auto i : variableIndex[
key])
28 factors.push_back(graph->
at(
i));
31 Cluster::addFactors(key, factors);
36 return factors.linearize(values);
40 auto nonlinearCluster = std::dynamic_pointer_cast<
NonlinearCluster>(cluster);
41 if (!nonlinearCluster)
42 throw std::runtime_error(
"Expected NonlinearCluster");
43 return nonlinearCluster.get();
53 return factors.linearizeToHessianFactor(values, ordering, dampen);
61 return factors.linearizeToHessianFactor(values, ordering, dampen);
71 for (
const auto& child : children) {
73 message->updateHessian(localFactor.get());
75 auto gaussianConditional = localFactor->eliminateCholesky(orderedFrontalKeys);
76 bayesNet.
add(gaussianConditional);
77 return {bayesNet, localFactor};
108 bayesNet->
push_back(bayesNet_newFactor_pair.first);
110 return bayesNet_newFactor_pair.second;
122 bayesNet->
push_back(bayesNet_newFactor_pair.first);
124 return bayesNet_newFactor_pair.second;
131 for (
const auto& root :
roots_) {
const gtsam::Symbol key('X', 0)
GaussianFactorGraph::shared_ptr linearize(const Values &values)
FastVector< sharedNode > roots_
Factor Graph consisting of non-linear factors.
std::shared_ptr< This > shared_ptr
A shared_ptr to this class.
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
const GaussianFactorGraph factors
Values updateCholesky(const Values &values)
NonlinearFactorGraph graph
static enum @1107 ordering
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
Values retract(const VectorValues &delta) const
HessianFactor::shared_ptr linearizeAndEliminate(const Values &values, GaussianBayesNet *bayesNet, const NonlinearFactorGraph::Dampen &dampen=nullptr) const
static NonlinearCluster * DownCast(const std::shared_ptr< Cluster > &cluster)
VectorValues optimize() const
HessianFactor::shared_ptr linearizeAndEliminate(const Values &values, GaussianBayesNet *bayesNet, const Ordering &ordering, const NonlinearFactorGraph::Dampen &dampen=nullptr) const
NonlinearCluster(const VariableIndex &variableIndex, const KeyVector &keys, NonlinearFactorGraph *graph)
static Ordering ColamdConstrainedFirst(const FACTOR_GRAPH &graph, const KeyVector &constrainFirst, bool forceOrder=false)
std::pair< GaussianBayesNet, HessianFactor::shared_ptr > linearizeAndEliminate(const Values &values, const NonlinearFactorGraph::Dampen &dampen=nullptr) const
std::shared_ptr< This > shared_ptr
shared_ptr to this class
HessianFactor::shared_ptr linearizeToHessianFactor(const Values &values, const Ordering &ordering, const NonlinearFactorGraph::Dampen &dampen=nullptr) const
const sharedFactor at(size_t i) const
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
HessianFactor::shared_ptr linearizeToHessianFactor(const Values &values, const NonlinearFactorGraph::Dampen &dampen=nullptr) const
std::pair< GaussianBayesNet, HessianFactor::shared_ptr > linearizeAndEliminate(const Values &values, const HessianFactor::shared_ptr &localFactor) const
std::function< void(const std::shared_ptr< HessianFactor > &hessianFactor)> Dampen
typdef for dampen functions used below
Gaussian Bayes Tree, the result of eliminating a GaussianJunctionTree.
std::uint64_t Key
Integer nonlinear key type.
std::pair< GaussianBayesNet, HessianFactor::shared_ptr > linearizeAndEliminate(const Values &values, const Ordering &ordering, const NonlinearFactorGraph::Dampen &dampen=nullptr) const
Collects factorgraph fragments defined on variable clusters, arranged in a tree.