gtsam 4.2.0
gtsam
Loading...
Searching...
No Matches
GaussianMixtureFactor.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
21#pragma once
22
29
30namespace gtsam {
31
32class HybridValues;
33class DiscreteValues;
34class VectorValues;
35
47class GTSAM_EXPORT GaussianMixtureFactor : public HybridFactor {
48 public:
49 using Base = HybridFactor;
51 using shared_ptr = boost::shared_ptr<This>;
52
53 using sharedFactor = boost::shared_ptr<GaussianFactor>;
54
57
58 private:
60 Factors factors_;
61
68 GaussianFactorGraphTree asGaussianFactorGraphTree() const;
69
70 public:
73
76
86 GaussianMixtureFactor(const KeyVector &continuousKeys,
87 const DiscreteKeys &discreteKeys,
88 const Factors &factors);
89
98 GaussianMixtureFactor(const KeyVector &continuousKeys,
99 const DiscreteKeys &discreteKeys,
100 const std::vector<sharedFactor> &factors)
101 : GaussianMixtureFactor(continuousKeys, discreteKeys,
102 Factors(discreteKeys, factors)) {}
103
107
108 bool equals(const HybridFactor &lf, double tol = 1e-9) const override;
109
110 void print(
111 const std::string &s = "GaussianMixtureFactor\n",
112 const KeyFormatter &formatter = DefaultKeyFormatter) const override;
113
117
119 sharedFactor operator()(const DiscreteValues &assignment) const;
120
130
138 AlgebraicDecisionTree<Key> error(const VectorValues &continuousValues) const;
139
144 double error(const HybridValues &values) const override;
145
149 sum = factor.add(sum);
150 return sum;
151 }
153
154 private:
156 friend class boost::serialization::access;
157 template <class ARCHIVE>
158 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
159 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
160 ar &BOOST_SERIALIZATION_NVP(factors_);
161 }
162};
163
164// traits
165template <>
166struct traits<GaussianMixtureFactor> : public Testable<GaussianMixtureFactor> {
167};
168
169} // namespace gtsam
specialized key for discrete variables
Algebraic Decision Trees.
Decision Tree for use in DiscreteFactors.
A factor with a quadratic error function - a Gaussian.
Linear Factor Graph where all factors are Gaussians.
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:86
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:156
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
An algebraic decision tree fixes the range of a DecisionTree to double.
Definition AlgebraicDecisionTree.h:38
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition DiscreteKey.h:39
A map from keys to values.
Definition DiscreteValues.h:34
Implementation of a discrete conditional mixture factor.
Definition GaussianMixtureFactor.h:47
GaussianMixtureFactor()=default
Default constructor, mainly for serialization.
GaussianMixtureFactor(const KeyVector &continuousKeys, const DiscreteKeys &discreteKeys, const std::vector< sharedFactor > &factors)
Construct a new GaussianMixtureFactor object using a vector of GaussianFactor shared pointers.
Definition GaussianMixtureFactor.h:98
GaussianFactorGraphTree add(const GaussianFactorGraphTree &sum) const
Combine the Gaussian Factor Graphs in sum and this while maintaining the original tree structure.
Definition GaussianMixtureFactor.cpp:85
friend GaussianFactorGraphTree & operator+=(GaussianFactorGraphTree &sum, const GaussianMixtureFactor &factor)
Add MixtureFactor to a Sum, syntactic sugar.
Definition GaussianMixtureFactor.h:147
Base class for truly hybrid probabilistic factors.
Definition HybridFactor.h:52
HybridValues represents a collection of DiscreteValues and VectorValues.
Definition HybridValues.h:38
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:74
The Factor::error simply extracts the.
the error.
The Factor::error simply extracts the.