gtsam  4.0.0
gtsam
DummyFactor.h
Go to the documentation of this file.
1 
10 #pragma once
11 
14 
15 namespace gtsam {
16 
17 class GTSAM_UNSTABLE_EXPORT DummyFactor : public NonlinearFactor {
18 protected:
19 
20  // Store the dimensions of the variables and the dimension of the full system
21  std::vector<size_t> dims_;
22  size_t rowDim_;
23 
24 public:
25 
27  DummyFactor() : rowDim_(1) { }
28 
30  DummyFactor(const Key& key1, size_t dim1, const Key& key2, size_t dim2);
31 
32  virtual ~DummyFactor() {}
33 
34  // testable
35 
37  virtual void print(const std::string& s = "", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
38 
40  virtual bool equals(const NonlinearFactor& f, double tol = 1e-9) const;
41 
42  // access
43 
44  const std::vector<size_t>& dims() const { return dims_; }
45 
46  // factor interface
47 
51  virtual double error(const Values& c) const { return 0.0; }
52 
54  virtual size_t dim() const { return rowDim_; }
55 
57  virtual boost::shared_ptr<GaussianFactor> linearize(const Values& c) const;
58 
65  virtual NonlinearFactor::shared_ptr clone() const {
66  return boost::static_pointer_cast<NonlinearFactor>(
67  NonlinearFactor::shared_ptr(new DummyFactor(*this)));
68  }
69 
70 };
71 
72 } // \namespace gtsam
73 
74 
75 
76 
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:70
virtual double error(const Values &c) const
Calculate the error of the factor - zero for dummy factors.
Definition: DummyFactor.h:51
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
size_t rowDim_
choose dimension for the rows
Definition: DummyFactor.h:22
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
DummyFactor()
Default constructor: don't use directly.
Definition: DummyFactor.h:27
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
Nonlinear factor base class.
Definition: NonlinearFactor.h:50
Definition: DummyFactor.h:17
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
virtual size_t dim() const
get the dimension of the factor (number of rows on linearization)
Definition: DummyFactor.h:54
virtual NonlinearFactor::shared_ptr clone() const
Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.
Definition: DummyFactor.h:65
Symbols for exporting classes and methods from DLLs.