26 #include <boost/bind.hpp> 35 template<
class FACTOR>
37 std::cout << s << std::endl;
38 std::cout <<
"size: " << size() << std::endl;
39 for (
size_t i = 0; i < factors_.size(); i++) {
41 ss <<
"factor " << i <<
": ";
43 factors_[i]->print(ss.str(), formatter);
48 template<
class FACTOR>
51 if (factors_.size() != fg.
size())
return false;
54 for (
size_t i = 0; i < factors_.size(); i++) {
57 if (f1 == NULL && f2 == NULL)
continue;
58 if (f1 == NULL || f2 == NULL)
return false;
59 if (!f1->equals(*f2, tol))
return false;
65 template<
class FACTOR>
74 template<
class FACTOR>
79 keys.insert(factor->begin(), factor->end());
85 template <
class FACTOR>
88 keys.reserve(2 * size());
91 keys.insert(keys.end(), factor->begin(), factor->end());
92 std::sort(keys.begin(), keys.end());
93 auto last = std::unique(keys.begin(), keys.end());
94 keys.erase(last, keys.end());
void print(const std::string &s="FactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const
print out graph
Definition: FactorGraph-inst.h:36
KeyVector keyVector() const
Potentially slow function to return all keys involved, sorted, as a vector.
Definition: FactorGraph-inst.h:86
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
size_t nrFactors() const
return the number of non-null factors
Definition: FactorGraph-inst.h:66
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:56
boost::shared_ptr< NonlinearFactor > sharedFactor
Shared pointer to a factor.
Definition: FactorGraph.h:88
bool equals(const This &fg, double tol=1e-9) const
Check equality.
Definition: FactorGraph-inst.h:49
FastVector< sharedFactor > factors_
concept check, makes sure FACTOR defines print and equals
Definition: FactorGraph.h:102
KeySet keys() const
Potentially slow function to return all keys involved, sorted, as a set.
Definition: FactorGraph-inst.h:75
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
size_t size() const
return the number of factors (including any null factors set by remove() ).
Definition: FactorGraph.h:275