24 #include <boost/serialization/nvp.hpp> 60 typedef boost::shared_ptr<Factor> shared_ptr;
82 template<
typename CONTAINER>
83 explicit Factor(
const CONTAINER& keys) : keys_(keys.begin(), keys.end()) {}
87 template<
typename ITERATOR>
88 Factor(ITERATOR first, ITERATOR last) : keys_(first, last) {}
92 template<
typename CONTAINER>
94 return Factor(keys.begin(), keys.end()); }
98 template<
typename ITERATOR>
100 return Factor(first, last); }
129 size_t size()
const {
return keys_.size(); }
138 void print(
const std::string& s =
"Factor",
const KeyFormatter& formatter = DefaultKeyFormatter)
const;
141 void printKeys(
const std::string& s =
"Factor",
const KeyFormatter& formatter = DefaultKeyFormatter)
const;
145 bool equals(
const This& other,
double tol = 1e-9)
const;
164 friend class boost::serialization::access;
165 template<
class Archive>
166 void serialize(Archive & ar,
const unsigned int ) {
167 ar & BOOST_SERIALIZATION_NVP(keys_);
This is the base class for all factor types.
Definition: Factor.h:54
static Factor FromIterators(ITERATOR first, ITERATOR last)
Construct factor from iterator keys.
Definition: Factor.h:99
A thin wrapper around std::vector that uses a custom allocator.
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
const_iterator find(Key key) const
find
Definition: Factor.h:115
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
KeyVector & keys()
Definition: Factor.h:154
Template to create a binary predicate.
Definition: Testable.h:110
Factor(const CONTAINER &keys)
Construct factor from container of keys.
Definition: Factor.h:83
Key front() const
First key.
Definition: Factor.h:109
iterator end()
Iterator at end of involved variable keys.
Definition: Factor.h:160
static Factor FromKeys(const CONTAINER &keys)
Construct factor from container of keys.
Definition: Factor.h:93
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 size() const
Definition: Factor.h:129
iterator begin()
Iterator at beginning of involved variable keys.
Definition: Factor.h:157
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:56
Factor()
Default constructor for I/O.
Definition: Factor.h:78
Factor(ITERATOR first, ITERATOR last)
Construct factor from iterator keys.
Definition: Factor.h:88
FastVector< FactorIndex > FactorIndices
Define collection types:
Definition: Factor.h:32
const KeyVector & keys() const
Access the factor's involved variable keys.
Definition: Factor.h:118
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
KeyVector keys_
The keys involved in this factor.
Definition: Factor.h:72
KeyVector::iterator iterator
Iterator over keys.
Definition: Factor.h:64
KeyVector::const_iterator const_iterator
Const iterator over keys.
Definition: Factor.h:67
Key back() const
Last key.
Definition: Factor.h:112
const_iterator begin() const
Iterator at beginning of involved variable keys.
Definition: Factor.h:121
const_iterator end() const
Iterator at end of involved variable keys.
Definition: Factor.h:124
Typedefs for easier changing of types.