gtsam
Loading...
Searching...
No Matches
GaussianBayesTree.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
19
20#pragma once
21
28
29namespace gtsam {
30
31 // Forward declarations
33 class VectorValues;
34
35 /* ************************************************************************* */
37 class GTSAM_EXPORT GaussianBayesTreeClique :
38 public BayesTreeCliqueBase<GaussianBayesTreeClique, GaussianFactorGraph>
39 {
40 public:
41 typedef GaussianBayesTreeClique This;
43 typedef std::shared_ptr<This> shared_ptr;
44 typedef std::weak_ptr<This> weak_ptr;
45 GaussianBayesTreeClique() {}
46 GaussianBayesTreeClique(const std::shared_ptr<GaussianConditional>& conditional) : Base(conditional) {}
47 };
48
49 /* ************************************************************************* */
51 class GTSAM_EXPORT GaussianBayesTree :
52 public BayesTree<GaussianBayesTreeClique>
53 {
54 private:
56
57 public:
58 typedef GaussianBayesTree This;
59 typedef std::shared_ptr<This> shared_ptr;
60
63
65 bool equals(const This& other, double tol = 1e-9) const;
66
68 VectorValues optimize() const;
69
95 VectorValues optimizeGradientSearch() const;
96
102 VectorValues gradient(const VectorValues& x0) const;
103
109 VectorValues gradientAtZero() const;
110
112 double error(const VectorValues& x) const;
113
119 double determinant() const;
120
126 double logDeterminant() const;
127
129 Matrix marginalInformation(Key key) const;
130
132 Matrix marginalCovariance(Key key) const;
133
135 Matrix marginalInformation(Key key, const Eliminate& eliminate) const {
136 return internal::marginalInformation(*this, key, eliminate);
137 }
138
140 Matrix marginalCovariance(Key key, const Eliminate& eliminate) const {
141 return internal::jointMarginalCovariance(*this, KeyVector{key}, eliminate)
142 .fullMatrix();
143 }
144
146 JointMarginal jointMarginalInformation(const KeyVector& queryKeys) const;
147
149 JointMarginal jointMarginalCovariance(const KeyVector& queryKeys) const;
150
154 const Eliminate& eliminate) const {
155 return internal::jointMarginalInformation(*this, queryKeys, eliminate);
156 }
157
161 const Eliminate& eliminate) const {
162 return internal::jointMarginalCovariance(*this, queryKeys, eliminate);
163 }
164 };
165
167 template<>
168 struct traits<GaussianBayesTree> : public Testable<GaussianBayesTree> {
169 };
170
171} //\ namespace gtsam
172
173#if GTSAM_ENABLE_BOOST_SERIALIZATION
174BOOST_CLASS_VERSION(gtsam::GaussianBayesTree, 1)
175#endif
Base class for cliques of a BayesTree.
Bayes Tree is a tree of cliques of a Bayes Chain.
Block access to joint Gaussian covariance or information matrices.
Chordal Bayes Net, the result of eliminating a factor graph.
Linear Factor Graph where all factors are Gaussians.
Internal helpers for Gaussian Bayes-tree covariance queries.
JointMarginal jointMarginalInformation(const BAYESTREE &bayesTree, const KeyVector &queryKeys, const typename BAYESTREE::FactorGraphType::Eliminate &eliminate)
Return joint marginal information with blocks in query-key order.
Definition GaussianBayesTreeQueries.h:209
Matrix marginalInformation(const BAYESTREE &bayesTree, Key key, const typename BAYESTREE::FactorGraphType::Eliminate &eliminate)
Return marginal information for one key using the requested elimination.
Definition GaussianBayesTreeQueries.h:200
JointMarginal jointMarginalCovariance(const BAYESTREE &bayesTree, const KeyVector &queryKeys, const typename BAYESTREE::FactorGraphType::Eliminate &eliminate)
Return joint marginal covariance with blocks in query-key order.
Definition GaussianBayesTreeQueries.h:228
Global functions in a separate testing namespace.
Definition chartTesting.h:28
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
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
Template to create a binary predicate.
Definition Testable.h:112
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
BayesTree()
Definition BayesTree.h:119
const sharedConditional & conditional() const
Definition BayesTreeCliqueBase.h:140
A Bayes tree representing a Gaussian density.
Definition GaussianBayesTree.h:53
GaussianBayesTree()
Default constructor, creates an empty Bayes tree.
Definition GaussianBayesTree.h:62
JointMarginal jointMarginalCovariance(const KeyVector &queryKeys, const Eliminate &eliminate) const
Return joint marginal covariance in queryKeys order using an elimination rule.
Definition GaussianBayesTree.h:160
Matrix marginalInformation(Key key, const Eliminate &eliminate) const
Return the marginal information matrix using a specific elimination rule.
Definition GaussianBayesTree.h:135
Matrix marginalCovariance(Key key, const Eliminate &eliminate) const
Return the marginal covariance matrix using a specific elimination rule.
Definition GaussianBayesTree.h:140
JointMarginal jointMarginalInformation(const KeyVector &queryKeys, const Eliminate &eliminate) const
Return joint marginal information in queryKeys order using an elimination rule.
Definition GaussianBayesTree.h:153
A GaussianConditional functions as the node in a Bayes network.
Definition GaussianConditional.h:43
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