gtsam
Loading...
Searching...
No Matches
Marginals.h
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
18
19#pragma once
20
25
26namespace gtsam {
27
31class GTSAM_EXPORT Marginals {
32
33 public:
38 CHOLESKY,
39 QR
40 };
41
42 protected:
44 Values values_;
45 Factorization factorization_;
46 GaussianBayesTree bayesTree_;
47
48 public:
49
52
58 Marginals(const NonlinearFactorGraph& graph, const Values& solution,
59 Factorization factorization = CHOLESKY);
60
67 Marginals(const NonlinearFactorGraph& graph, const Values& solution, const Ordering& ordering,
68 Factorization factorization = CHOLESKY);
69
75 Marginals(const GaussianFactorGraph& graph, const Values& solution, Factorization factorization = CHOLESKY);
76
83 Marginals(const GaussianFactorGraph& graph, const Values& solution, const Ordering& ordering,
84 Factorization factorization = CHOLESKY);
85
92 Marginals(const GaussianFactorGraph& graph, const VectorValues& solution, Factorization factorization = CHOLESKY);
93
100 Marginals(const GaussianFactorGraph& graph, const VectorValues& solution, const Ordering& ordering,
101 Factorization factorization = CHOLESKY);
102
110 Marginals(GaussianBayesTree&& bayesTree, const VectorValues& solution,
111 Factorization factorization = CHOLESKY);
112
114 void print(const std::string& str = "Marginals: ", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
115
117 GaussianFactor::shared_ptr marginalFactor(Key variable) const;
118
120 Matrix marginalInformation(Key variable) const;
121
123 Matrix marginalCovariance(Key variable) const;
124
126 JointMarginal jointMarginalCovariance(const KeyVector& variables) const;
127
129 JointMarginal jointMarginalInformation(const KeyVector& variables) const;
130
132 void deleteCachedShortcuts();
133
135 VectorValues optimize() const;
136
137 protected:
139 GaussianFactorGraph::Eliminate eliminationFunction() const;
140
142 void computeBayesTree();
143
145 void computeBayesTree(const Ordering& ordering);
146};
147
148} /* namespace gtsam */
Block access to joint Gaussian covariance or information matrices.
Gaussian Bayes Tree, the result of eliminating a GaussianJunctionTree.
A non-templated config holding any types of Manifold-group elements.
Factor Graph consisting of non-linear factors.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition Key.h:91
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition triangulation.cpp:178
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
std::function< EliminationResult(const FactorGraphType &, const Ordering &)> Eliminate
Definition EliminateableFactorGraph.h:91
Definition Ordering.h:33
A Bayes tree representing a Gaussian density.
Definition GaussianBayesTree.h:53
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition GaussianFactor.h:42
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition GaussianFactorGraph.h:77
A class to store and access a joint marginal, returned from Gaussian and nonlinear covariance query A...
Definition JointMarginal.h:34
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:73
A class for computing Gaussian marginals of variables in a NonlinearFactorGraph.
Definition Marginals.h:31
Factorization
The linear factorization mode - either CHOLESKY (faster and suitable for most problems) or QR (slower...
Definition Marginals.h:37
Marginals()
Default constructor only for wrappers.
Definition Marginals.h:51
Definition NonlinearFactorGraph.h:57
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65