SubgraphSolver.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
21 
27 
28 using namespace std;
29 
30 namespace gtsam {
31 
32 /**************************************************************************************************/
33 // Just taking system [A|b]
34 SubgraphSolver::SubgraphSolver(const GaussianFactorGraph &Ab,
35  const Parameters &parameters, const Ordering& ordering) :
36  parameters_(parameters) {
37  const auto [Ab1, Ab2] = splitGraph(Ab);
38  if (parameters_.verbosity())
39  cout << "Split A into (A1) " << Ab1.size() << " and (A2) " << Ab2.size()
40  << " factors" << endl;
41 
42  auto Rc1 = *Ab1.eliminateSequential(ordering, EliminateQR);
43  auto xbar = Rc1.optimize();
44  pc_ = std::make_shared<SubgraphPreconditioner>(Ab2, Rc1, xbar);
45 }
46 
47 /**************************************************************************************************/
48 // Taking eliminated tree [R1|c] and constraint graph [A2|b2]
50  const GaussianFactorGraph &Ab2,
51  const Parameters &parameters)
52  : parameters_(parameters) {
53  auto xbar = Rc1.optimize();
54  pc_ = std::make_shared<SubgraphPreconditioner>(Ab2, Rc1, xbar);
55 }
56 
57 /**************************************************************************************************/
58 // Taking subgraphs [A1|b1] and [A2|b2]
59 // delegate up
61  const GaussianFactorGraph &Ab2,
62  const Parameters &parameters,
63  const Ordering &ordering)
64  : SubgraphSolver(*Ab1.eliminateSequential(ordering, EliminateQR), Ab2,
65  parameters) {}
66 
67 /**************************************************************************************************/
70  Errors>(*pc_, pc_->zero(), parameters_);
71  return pc_->x(ybar);
72 }
73 
75  const KeyInfo &keyInfo, const map<Key, Vector> &lambda,
76  const VectorValues &initial) {
77  return VectorValues();
78 }
79 /**************************************************************************************************/
80 pair<GaussianFactorGraph, GaussianFactorGraph> //
82 
83  /* identify the subgraph structure */
85  auto subgraph = builder(factorGraph);
86 
87  /* build factor subgraph */
88  return splitFactorGraph(factorGraph, subgraph);
89 }
90 
91 /****************************************************************************/
92 
93 } // \namespace gtsam
Subgraph Solver from IROS 2010.
std::pair< GaussianFactorGraph, GaussianFactorGraph > splitGraph(const GaussianFactorGraph &gfg)
Split graph using Kruskal algorithm, treating binary factors as edges.
Definition: BFloat16.h:88
V conjugateGradients(const S &Ab, V x, const ConjugateGradientParameters &parameters, bool steepest)
static enum @1107 ordering
VectorValues optimize() const
SubgraphBuilderParameters builderParams
Linear Factor Graph where all factors are Gaussians.
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)
Iterative methods, template implementation.
static ConjugateGradientParameters parameters
cout<< "The eigenvalues of A are:"<< endl<< ces.eigenvalues()<< endl;cout<< "The matrix of eigenvectors, V, is:"<< endl<< ces.eigenvectors()<< endl<< endl;complex< float > lambda
traits
Definition: chartTesting.h:28
VectorValues optimize() const
Optimize from zero.
SubgraphSolver(const GaussianFactorGraph &A, const Parameters &parameters, const Ordering &ordering)
std::shared_ptr< SubgraphPreconditioner > pc_
preconditioner object
Chordal Bayes Net, the result of eliminating a factor graph.
std::pair< GaussianFactorGraph, GaussianFactorGraph > splitFactorGraph(const GaussianFactorGraph &factorGraph, const Subgraph &subgraph)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:36:21