LinearContainerFactor.h
Go to the documentation of this file.
1 
10 #pragma once
11 
13 
14 namespace gtsam {
15 
16  // Forward declarations
17  class JacobianFactor;
18  class HessianFactor;
19 
27 protected:
28 
30  boost::optional<Values> linearizationPoint_;
31 
34 
36  GTSAM_EXPORT LinearContainerFactor(const GaussianFactor::shared_ptr& factor, const boost::optional<Values>& linearizationPoint);
37 
38  // Some handy typedefs
40  typedef LinearContainerFactor This;
41 
42 public:
43 
44  typedef boost::shared_ptr<This> shared_ptr;
45 
47  GTSAM_EXPORT LinearContainerFactor(const JacobianFactor& factor, const Values& linearizationPoint = Values());
48 
50  GTSAM_EXPORT LinearContainerFactor(const HessianFactor& factor, const Values& linearizationPoint = Values());
51 
53  GTSAM_EXPORT LinearContainerFactor(const GaussianFactor::shared_ptr& factor, const Values& linearizationPoint = Values());
54 
55  // Access
56 
57  const GaussianFactor::shared_ptr& factor() const { return factor_; }
58 
59  // Testable
60 
62  GTSAM_EXPORT void print(const std::string& s = "", const KeyFormatter& keyFormatter = gtsam::DefaultKeyFormatter) const override;
63 
65  GTSAM_EXPORT bool equals(const NonlinearFactor& f, double tol = 1e-9) const override;
66 
67  // NonlinearFactor
68 
77  GTSAM_EXPORT double error(const Values& c) const override;
78 
80  GTSAM_EXPORT size_t dim() const override;
81 
83  const boost::optional<Values>& linearizationPoint() const { return linearizationPoint_; }
84 
101  GTSAM_EXPORT GaussianFactor::shared_ptr linearize(const Values& c) const override;
102 
106  GTSAM_EXPORT GaussianFactor::shared_ptr negateToGaussian() const;
107 
111  GTSAM_EXPORT NonlinearFactor::shared_ptr negateToNonlinear() const;
112 
120  return NonlinearFactor::shared_ptr(new LinearContainerFactor(factor_,linearizationPoint_));
121  }
122 
123  // casting syntactic sugar
124 
125  inline bool hasLinearizationPoint() const { return linearizationPoint_.is_initialized(); }
126 
130  GTSAM_EXPORT bool isJacobian() const;
131  GTSAM_EXPORT bool isHessian() const;
132 
134  GTSAM_EXPORT boost::shared_ptr<JacobianFactor> toJacobian() const;
135 
137  GTSAM_EXPORT boost::shared_ptr<HessianFactor> toHessian() const;
138 
143  GTSAM_EXPORT
145  const Values& linearizationPoint = Values());
146 
147  protected:
148  GTSAM_EXPORT void initializeLinearizationPoint(const Values& linearizationPoint);
149 
150  private:
153  template<class ARCHIVE>
154  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
155  ar & boost::serialization::make_nvp("NonlinearFactor",
156  boost::serialization::base_object<Base>(*this));
157  ar & BOOST_SERIALIZATION_NVP(factor_);
158  ar & BOOST_SERIALIZATION_NVP(linearizationPoint_);
159  }
160 
161 }; // \class LinearContainerFactor
162 
163 template<> struct traits<LinearContainerFactor> : public Testable<LinearContainerFactor> {};
164 
165 } // \namespace gtsam
166 
Factor Graph consisting of non-linear factors.
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
static const KeyFormatter DefaultKeyFormatter
Definition: Key.h:43
GTSAM_EXPORT boost::shared_ptr< HessianFactor > toHessian() const
const GaussianFactor::shared_ptr & factor() const
GaussianFactor::shared_ptr factor_
GTSAM_EXPORT GaussianFactor::shared_ptr negateToGaussian() const
friend class boost::serialization::access
GTSAM_EXPORT bool isHessian() const
const boost::optional< Values > & linearizationPoint() const
boost::shared_ptr< This > shared_ptr
GTSAM_EXPORT boost::shared_ptr< JacobianFactor > toJacobian() const
GTSAM_EXPORT size_t dim() const override
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
boost::shared_ptr< This > shared_ptr
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
GTSAM_EXPORT void print(const std::string &s="", const KeyFormatter &keyFormatter=gtsam::DefaultKeyFormatter) const override
GTSAM_EXPORT NonlinearFactor::shared_ptr negateToNonlinear() const
GTSAM_EXPORT bool equals(const NonlinearFactor &f, double tol=1e-9) const override
traits
Definition: chartTesting.h:28
std::vector< float > Values
NonlinearFactor::shared_ptr clone() const override
GTSAM_EXPORT bool isJacobian() const
GTSAM_EXPORT void initializeLinearizationPoint(const Values &linearizationPoint)
boost::optional< Values > linearizationPoint_
A Gaussian factor using the canonical parameters (information form)
const G double tol
Definition: Group.h:83
static GTSAM_EXPORT NonlinearFactorGraph ConvertLinearGraph(const GaussianFactorGraph &linear_graph, const Values &linearizationPoint=Values())
GTSAM_EXPORT GaussianFactor::shared_ptr linearize(const Values &c) const override
void serialize(ARCHIVE &ar, const unsigned int)
GTSAM_EXPORT double error(const Values &c) const override


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:31