HybridNonlinearFactor.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 
20 #pragma once
21 
27 #include <gtsam/nonlinear/Symbol.h>
28 
29 #include <vector>
30 
31 namespace gtsam {
32 
35  std::pair<NoiseModelFactor::shared_ptr, double>;
36 
58 class GTSAM_EXPORT HybridNonlinearFactor : public HybridFactor {
59  public:
60  using Base = HybridFactor;
62  using shared_ptr = std::shared_ptr<HybridNonlinearFactor>;
63  using sharedFactor = std::shared_ptr<NoiseModelFactor>;
64 
70 
71  private:
74 
77  const VectorValues& continuousValues) const override {
78  throw std::runtime_error(
79  "HybridNonlinearFactor::error does not take VectorValues.");
80  }
81 
82  public:
84  HybridNonlinearFactor() = default;
85 
95  const DiscreteKey& discreteKey,
96  const std::vector<NoiseModelFactor::shared_ptr>& factors);
97 
107  HybridNonlinearFactor(const DiscreteKey& discreteKey,
108  const std::vector<NonlinearFactorValuePair>& pairs);
109 
119  HybridNonlinearFactor(const DiscreteKeys& discreteKeys,
120  const FactorValuePairs& factors);
121 
130  AlgebraicDecisionTree<Key> errorTree(const Values& continuousValues) const;
131 
139  double error(const Values& continuousValues,
140  const DiscreteValues& discreteValues) const;
141 
148  double error(const HybridValues& values) const override;
149 
155  size_t dim() const;
156 
159 
161  void print(const std::string& s = "", const KeyFormatter& keyFormatter =
162  DefaultKeyFormatter) const override;
163 
165  bool equals(const HybridFactor& other, double tol = 1e-9) const override;
166 
168 
171  GaussianFactor::shared_ptr linearize(
172  const Values& continuousValues,
173  const DiscreteValues& discreteValues) const;
174 
176  std::shared_ptr<HybridGaussianFactor> linearize(
177  const Values& continuousValues) const;
178 
179  private:
181  struct ConstructorHelper;
182 
183  // Private constructor using ConstructorHelper above.
184  HybridNonlinearFactor(const ConstructorHelper& helper);
185 };
186 
187 // traits
188 template <>
189 struct traits<HybridNonlinearFactor> : public Testable<HybridNonlinearFactor> {
190 };
191 
192 } // namespace gtsam
gtsam::HybridValues
Definition: HybridValues.h:37
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
simple_graph::factors
const GaussianFactorGraph factors
Definition: testJacobianFactor.cpp:213
gtsam::HybridFactor
Definition: HybridFactor.h:51
gtsam::HybridFactor::shared_ptr
std::shared_ptr< HybridFactor > shared_ptr
shared_ptr to this class
Definition: HybridFactor.h:70
Symbol.h
Symbol.h was moved to inference directory, this header was retained for compatibility.
different_sigmas::values
HybridValues values
Definition: testHybridBayesNet.cpp:245
gtsam::Factor
Definition: Factor.h:70
gtsam::DiscreteKeys
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition: DiscreteKey.h:41
HybridGaussianFactor.h
A set of GaussianFactors, indexed by a set of discrete keys.
gtsam::DefaultKeyFormatter
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition: Key.cpp:30
gtsam::AlgebraicDecisionTree< Key >
gtsam::print
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
gtsam::VectorValues
Definition: VectorValues.h:74
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::GaussianFactor::shared_ptr
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianFactor.h:42
gtsam::HybridNonlinearFactor::sharedFactor
std::shared_ptr< NoiseModelFactor > sharedFactor
Definition: HybridNonlinearFactor.h:63
gtsam::equals
Definition: Testable.h:112
NonlinearFactor.h
Non-linear factor base classes.
gtsam::DecisionTree< Key, NonlinearFactorValuePair >
gtsam
traits
Definition: SFMdata.h:40
gtsam::Testable
Definition: Testable.h:152
DiscreteValues.h
error
static double error
Definition: testRot3.cpp:37
gtsam::traits
Definition: Group.h:36
NonlinearFactorGraph.h
Factor Graph consisting of non-linear factors.
gtsam::DiscreteValues
Definition: DiscreteValues.h:34
gtsam::Values
Definition: Values.h:65
gtsam::DiscreteKey
std::pair< Key, size_t > DiscreteKey
Definition: DiscreteKey.h:38
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::HybridNonlinearFactor::factors_
FactorValuePairs factors_
Decision tree of nonlinear factors indexed by discrete keys.
Definition: HybridNonlinearFactor.h:73
gtsam::NonlinearFactorValuePair
std::pair< NoiseModelFactor::shared_ptr, double > NonlinearFactorValuePair
Alias for a NoiseModelFactor shared pointer and double scalar pair.
Definition: HybridNonlinearFactor.h:35
gtsam::HybridNonlinearFactor::errorTree
AlgebraicDecisionTree< Key > errorTree(const VectorValues &continuousValues) const override
HybridFactor method implementation. Should not be used.
Definition: HybridNonlinearFactor.h:76
HybridValues.h
gtsam::HybridNonlinearFactor
Implementation of a discrete-conditioned hybrid factor.
Definition: HybridNonlinearFactor.h:58
pybind_wrapper_test_script.other
other
Definition: pybind_wrapper_test_script.py:42


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:43