gtsam
Loading...
Searching...
No Matches
HybridGaussianProductFactor.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
18
19#pragma once
20
22#include <gtsam/inference/Key.h>
24
25#include <iostream>
26
27namespace gtsam {
28
30
31using GaussianFactorGraphValuePair = std::pair<GaussianFactorGraph, double>;
32
35 : public DecisionTree<Key, GaussianFactorGraphValuePair> {
36 public:
38
41
44
50 template <class FACTOR>
51 HybridGaussianProductFactor(const std::shared_ptr<FACTOR>& factor)
52 : Base(GaussianFactorGraphValuePair{GaussianFactorGraph{factor}, 0.0}) {}
53
58 HybridGaussianProductFactor(Base&& tree) : Base(std::move(tree)) {}
59
61
64
67 const GaussianFactor::shared_ptr& factor) const;
68
71 const HybridGaussianFactor& factor) const;
72
75 const GaussianFactor::shared_ptr& factor);
76
78 HybridGaussianProductFactor& operator+=(const HybridGaussianFactor& factor);
79
81
84
90 void print(const std::string& s = "",
91 const KeyFormatter& formatter = DefaultKeyFormatter) const;
92
99 bool equals(const HybridGaussianProductFactor& other,
100 double tol = 1e-9) const;
101
103
106
117 HybridGaussianProductFactor removeEmpty() const;
118
120
121 private:
122#if GTSAM_ENABLE_BOOST_SERIALIZATION
124 friend class boost::serialization::access;
125 template <class Archive>
126 void serialize(Archive& ar, const unsigned int /*version*/) {
127 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
128 }
129#endif
130};
131
132// Testable traits
133template <>
135 : public Testable<HybridGaussianProductFactor> {};
136
145std::istream& operator>>(std::istream& is, GaussianFactorGraphValuePair& pair);
146
147} // namespace gtsam
Decision Tree for use in DiscreteFactors.
Linear Factor Graph where all factors are Gaussians.
STL namespace.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
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
istream & operator>>(istream &inputStream, Matrix &destinationMatrix)
Read a matrix from an input stream, such as a file.
Definition Matrix.cpp:161
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
Template to create a binary predicate.
Definition Testable.h:112
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
Implementation of a discrete-conditioned hybrid factor.
Definition HybridGaussianFactor.h:60
Alias for DecisionTree of GaussianFactorGraphs and their scalar sums.
Definition HybridGaussianProductFactor.h:35
HybridGaussianProductFactor()=default
Default constructor.
HybridGaussianProductFactor(const std::shared_ptr< FACTOR > &factor)
Construct from a single factor.
Definition HybridGaussianProductFactor.h:51
HybridGaussianProductFactor(Base &&tree)
Construct from DecisionTree.
Definition HybridGaussianProductFactor.h:58
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition GaussianFactor.h:42
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition GaussianFactorGraph.h:77