gtsam  4.0.0
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 
25 #include <gtsam/global_includes.h>
26 
27 namespace 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>
56  GaussianBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph) : Base(graph) {}
57 
59 
62 
64  bool equals(const This& bn, double tol = 1e-9) const;
65 
67 
70 
72  VectorValues optimize() const;
73 
75  VectorValues optimize(const VectorValues& solutionForMissing) const;
76 
78 
81 
85  std::pair<Matrix, Vector> matrix() const;
86 
112  VectorValues optimizeGradientSearch() const;
113 
119  VectorValues gradient(const VectorValues& x0) const;
120 
127  VectorValues gradientAtZero() const;
128 
130  double error(const VectorValues& x) const;
131 
139  double determinant() const;
140 
147  double logDeterminant() const;
148 
153  VectorValues backSubstitute(const VectorValues& gx) const;
154 
161  VectorValues backSubstituteTranspose(const VectorValues& gx) const;
162 
164 
165  private:
167  friend class boost::serialization::access;
168  template<class ARCHIVE>
169  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
170  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
171  }
172  };
173 
175  template<>
176  struct traits<GaussianBayesNet> : public Testable<GaussianBayesNet> {
177  };
178 
179 } //\ namespace gtsam
A Bayes net made from linear-Gaussian densities.
Definition: GaussianBayesNet.h:30
A conditional Gaussian functions as the node in a Bayes network It has a set of parents y...
Definition: GaussianConditional.h:36
Included from all GTSAM files.
Conditional Gaussian Base class.
Factor Graph Base Class.
GaussianBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
Construct from iterator over conditionals.
Definition: GaussianBayesNet.h:48
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
GaussianBayesNet(const FactorGraph< DERIVEDCONDITIONAL > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition: GaussianBayesNet.h:56
Template to create a binary predicate.
Definition: Testable.h:110
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:90
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
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
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition: triangulation.cpp:73
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition: BayesTree.h:32
Global functions in a separate testing namespace.
Definition: chartTesting.h:28