Loading...
Searching...
No Matches
GaussianBayesNet.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
// \callgraph
#pragma once
#include <gtsam/linear/GaussianConditional.h>
#include <gtsam/inference/BayesNet.h>
#include <gtsam/inference/FactorGraph.h>
#include <gtsam/global_includes.h>
#include <utility>
namespace gtsam {
class GTSAM_EXPORT GaussianBayesNet: public BayesNet<GaussianConditional>
{
public:
typedef BayesNet<GaussianConditional> Base;
typedef GaussianBayesNet This;
typedef GaussianConditional ConditionalType;
typedef boost::shared_ptr<This> shared_ptr;
typedef boost::shared_ptr<ConditionalType> sharedConditional;
GaussianBayesNet() {}
template <typename ITERATOR>
GaussianBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
: Base(firstConditional, lastConditional) {}
template <class CONTAINER>
explicit GaussianBayesNet(const CONTAINER& conditionals) {
push_back(conditionals);
}
template <class DERIVEDCONDITIONAL>
explicit GaussianBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph)
: Base(graph) {}
template <class DERIVEDCONDITIONAL>
GaussianBayesNet(
std::initializer_list<boost::shared_ptr<DERIVEDCONDITIONAL> > conditionals)
: Base(conditionals) {}
virtual ~GaussianBayesNet() = default;
bool equals(const This& bn, double tol = 1e-9) const;
void print(
const std::string& s = "",
const KeyFormatter& formatter = DefaultKeyFormatter) const override {
Base::print(s, formatter);
}
double error(const VectorValues& x) const;
double logProbability(const VectorValues& x) const;
double evaluate(const VectorValues& x) const;
double operator()(const VectorValues& x) const {
return evaluate(x);
}
VectorValues optimize() const;
VectorValues optimize(const VectorValues& given) const;
VectorValues sample(std::mt19937_64* rng) const;
VectorValues sample(const VectorValues& given, std::mt19937_64* rng) const;
VectorValues sample() const;
VectorValues sample(const VectorValues& given) const;
Ordering ordering() const;
std::pair<Matrix, Vector> matrix(const Ordering& ordering) const;
std::pair<Matrix, Vector> matrix() const;
VectorValues optimizeGradientSearch() const;
VectorValues gradient(const VectorValues& x0) const;
VectorValues gradientAtZero() const;
double determinant() const;
double logDeterminant() const;
VectorValues backSubstitute(const VectorValues& gx) const;
VectorValues backSubstituteTranspose(const VectorValues& gx) const;
using Base::evaluate; // Expose evaluate(const HybridValues&) method..
using Base::logProbability; // Expose logProbability(const HybridValues&) method..
using Base::error; // Expose error(const HybridValues&) method..
private:
friend class boost::serialization::access;
template<class ARCHIVE>
void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
}
};
template<>
struct traits<GaussianBayesNet> : public Testable<GaussianBayesNet> {
};
} //\ namespace gtsam
BayesNet.h
Bayes network.
FactorGraph.h
Factor Graph Base Class.
GaussianConditional.h
Conditional Gaussian Base class.
global_includes.h
Included from all GTSAM files.
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::optimize
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition triangulation.cpp:155
gtsam::KeyFormatter
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
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::Testable
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:151
gtsam::BayesNet< GaussianConditional >::print
void print(const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
gtsam::BayesNet< GaussianConditional >::BayesNet
BayesNet()
Definition BayesNet.h:48
gtsam::FactorGraph
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition FactorGraph.h:97
gtsam::FactorGraph::push_back
IsDerived< DERIVEDFACTOR > push_back(boost::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
Definition FactorGraph.h:186
gtsam::Ordering
Definition Ordering.h:34
gtsam::GaussianBayesNet
GaussianBayesNet is a Bayes net made from linear-Gaussian conditionals.
Definition GaussianBayesNet.h:36
gtsam::GaussianBayesNet::equals
bool equals(const This &bn, double tol=1e-9) const
Check equality.
Definition GaussianBayesNet.cpp:38
gtsam::GaussianBayesNet::operator()
double operator()(const VectorValues &x) const
Evaluate probability density, sugar.
Definition GaussianBayesNet.h:114
gtsam::GaussianBayesNet::print
void print(const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print graph
Definition GaussianBayesNet.h:89
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet(std::initializer_list< boost::shared_ptr< DERIVEDCONDITIONAL > > conditionals)
Constructor that takes an initializer list of shared pointers.
Definition GaussianBayesNet.h:73
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet(const FactorGraph< DERIVEDCONDITIONAL > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition GaussianBayesNet.h:65
gtsam::GaussianBayesNet::~GaussianBayesNet
virtual ~GaussianBayesNet()=default
Destructor.
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet(const CONTAINER &conditionals)
Construct from container of factors (shared_ptr or plain objects).
Definition GaussianBayesNet.h:58
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet()
Construct empty bayes net.
Definition GaussianBayesNet.h:49
gtsam::GaussianBayesNet::evaluate
double evaluate(const VectorValues &x) const
Calculate probability density for given values x: exp(logProbability) where x is the vector of values...
Definition GaussianBayesNet.cpp:124
gtsam::GaussianBayesNet::GaussianBayesNet
GaussianBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
Construct from iterator over conditionals.
Definition GaussianBayesNet.h:53
gtsam::GaussianConditional
A GaussianConditional functions as the node in a Bayes network.
Definition GaussianConditional.h:43
gtsam::VectorValues
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:74