gtsam  4.1.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>
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 
83  Ordering ordering() const;
84 
86 
89 
95  std::pair<Matrix, Vector> matrix(const Ordering& ordering) const;
96 
102  std::pair<Matrix, Vector> matrix() const;
103 
129  VectorValues optimizeGradientSearch() const;
130 
136  VectorValues gradient(const VectorValues& x0) const;
137 
144  VectorValues gradientAtZero() const;
145 
147  double error(const VectorValues& x) const;
148 
156  double determinant() const;
157 
164  double logDeterminant() const;
165 
170  VectorValues backSubstitute(const VectorValues& gx) const;
171 
178  VectorValues backSubstituteTranspose(const VectorValues& gx) const;
179 
181 
182  private:
184  friend class boost::serialization::access;
185  template<class ARCHIVE>
186  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
187  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
188  }
189  };
190 
192  template<>
193  struct traits<GaussianBayesNet> : public Testable<GaussianBayesNet> {
194  };
195 
196 } //\ namespace gtsam
gtsam::equals
Template to create a binary predicate.
Definition: Testable.h:110
gtsam::optimize
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition: triangulation.cpp:73
gtsam::Ordering
Definition: Ordering.h:34
gtsam::GaussianConditional
A conditional Gaussian functions as the node in a Bayes network It has a set of parents y,...
Definition: GaussianConditional.h:39
gtsam::traits
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
Construct from iterator over conditionals.
Definition: GaussianBayesNet.h:48
GaussianConditional.h
Conditional Gaussian Base class.
gtsam::VectorValues
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:74
gtsam::serialize
std::string serialize(const T &input)
serializes to a string
Definition: serialization.h:100
FactorGraph.h
Factor Graph Base Class.
gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
global_includes.h
Included from all GTSAM files.
gtsam::Testable
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
gtsam::GaussianBayesNet
A Bayes net made from linear-Gaussian densities.
Definition: GaussianBayesNet.h:31
gtsam::FactorGraph
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition: FactorGraph.h:94
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet(const FactorGraph< DERIVEDCONDITIONAL > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition: GaussianBayesNet.h:56
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet(const CONTAINER &conditionals)
Construct from container of factors (shared_ptr or plain objects)
Definition: GaussianBayesNet.h:52
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet()
Construct empty factor graph.
Definition: GaussianBayesNet.h:44