Factor.cpp
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 // \callgraph
21 
22 #include <iostream>
23 
24 #include <gtsam/inference/Factor.h>
25 
26 namespace gtsam {
27 
28  /* ************************************************************************* */
29  void Factor::print(const std::string& s, const KeyFormatter& formatter) const
30  {
31  return this->printKeys(s, formatter);
32  }
33 
34  /* ************************************************************************* */
35  void Factor::printKeys(const std::string& s, const KeyFormatter& formatter) const {
36  std::cout << (s.empty() ? "" : s + " ");
37  for (Key key : keys_) std::cout << " " << formatter(key);
38  std::cout << std::endl;
39  }
40 
41  /* ************************************************************************* */
42  bool Factor::equals(const This& other, double tol) const {
43  return keys_ == other.keys_;
44  }
45 
46  /* ************************************************************************* */
47  double Factor::error(const HybridValues& c) const {
48  throw std::runtime_error("Factor::error is not implemented");
49  }
50 
51 
52 }
gtsam::HybridValues
Definition: HybridValues.h:37
s
RealScalar s
Definition: level1_cplx_impl.h:126
gtsam::Factor::printKeys
virtual void printKeys(const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
print only keys
Definition: Factor.cpp:35
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
formatter
const KeyFormatter & formatter
Definition: treeTraversal-inst.h:204
gtsam::Factor
Definition: Factor.h:70
Factor.h
The base class for all factors.
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
key
const gtsam::Symbol key('X', 0)
gtsam
traits
Definition: SFMdata.h:40
gtsam::Factor::keys_
KeyVector keys_
The keys involved in this factor.
Definition: Factor.h:88
gtsam::Factor::equals
bool equals(const This &other, double tol=1e-9) const
check equality
Definition: Factor.cpp:42
gtsam::Factor::error
virtual double error(const HybridValues &c) const
Definition: Factor.cpp:47
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::Factor::print
virtual void print(const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
print
Definition: Factor.cpp:29
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
pybind_wrapper_test_script.other
other
Definition: pybind_wrapper_test_script.py:42


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:17