gtsam 4.1.1
gtsam
GaussianBayesNet.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// \callgraph
20
21#pragma once
22
26
27namespace gtsam {
28
30 class GTSAM_EXPORT GaussianBayesNet: public FactorGraph<GaussianConditional>
31 {
32 public:
33
35 typedef GaussianBayesNet This;
37 typedef boost::shared_ptr<This> shared_ptr;
38 typedef boost::shared_ptr<ConditionalType> sharedConditional;
39
42
45
47 template<typename ITERATOR>
48 GaussianBayesNet(ITERATOR firstConditional, ITERATOR lastConditional) : Base(firstConditional, lastConditional) {}
49
51 template<class CONTAINER>
52 explicit GaussianBayesNet(const CONTAINER& conditionals) : Base(conditionals) {}
53
55 template<class DERIVEDCONDITIONAL>
57
59 virtual ~GaussianBayesNet() {}
60
62
65
67 bool equals(const This& bn, double tol = 1e-9) const;
68
70
73
75 VectorValues optimize() const;
76
78 VectorValues optimize(const VectorValues& solutionForMissing) const;
79
86 Ordering ordering() const;
87
89
92
98 std::pair<Matrix, Vector> matrix(const Ordering& ordering) const;
99
105 std::pair<Matrix, Vector> matrix() const;
106
132 VectorValues optimizeGradientSearch() const;
133
139 VectorValues gradient(const VectorValues& x0) const;
140
147 VectorValues gradientAtZero() const;
148
150 double error(const VectorValues& x) const;
151
159 double determinant() const;
160
167 double logDeterminant() const;
168
173 VectorValues backSubstitute(const VectorValues& gx) const;
174
181 VectorValues backSubstituteTranspose(const VectorValues& gx) const;
182
184 void print(
185 const std::string& s = "",
186 const KeyFormatter& formatter = DefaultKeyFormatter) const override {
187 Base::print(s, formatter);
188 }
189
197 void saveGraph(const std::string& s, const KeyFormatter& keyFormatter =
198 DefaultKeyFormatter) const;
199
201
202 private:
204 friend class boost::serialization::access;
205 template<class ARCHIVE>
206 void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
207 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
208 }
209 };
210
212 template<>
213 struct traits<GaussianBayesNet> : public Testable<GaussianBayesNet> {
214 };
215
216} //\ namespace gtsam
Factor Graph Base Class.
Conditional Gaussian Base class.
Included from all GTSAM files.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
std::string serialize(const T &input)
serializes to a string
Definition: serialization.h:112
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition: triangulation.cpp:73
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:155
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
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Template to create a binary predicate.
Definition: Testable.h:111
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:151
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition: FactorGraph.h:93
Definition: Ordering.h:34
A Bayes net made from linear-Gaussian densities.
Definition: GaussianBayesNet.h:31
void print(const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print graph
Definition: GaussianBayesNet.h:184
GaussianBayesNet(const FactorGraph< DERIVEDCONDITIONAL > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition: GaussianBayesNet.h:56
virtual ~GaussianBayesNet()
Destructor.
Definition: GaussianBayesNet.h:59
GaussianBayesNet(const CONTAINER &conditionals)
Construct from container of factors (shared_ptr or plain objects)
Definition: GaussianBayesNet.h:52
GaussianBayesNet()
Construct empty factor graph.
Definition: GaussianBayesNet.h:44
GaussianBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
Construct from iterator over conditionals.
Definition: GaussianBayesNet.h:48
A conditional Gaussian functions as the node in a Bayes network It has a set of parents y,...
Definition: GaussianConditional.h:39
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:74