24 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 25 #include <boost/serialization/nvp.hpp> 97 template<
typename CONTAINER>
98 explicit Factor(
const CONTAINER&
keys) : keys_(keys.begin(), keys.
end()) {}
102 template<
typename ITERATOR>
103 Factor(ITERATOR first, ITERATOR
last) : keys_(first, last) {}
107 template<
typename CONTAINER>
109 return Factor(keys.begin(), keys.end()); }
113 template<
typename ITERATOR>
115 return Factor(first, last); }
124 virtual ~
Factor() =
default;
130 bool empty()
const {
return keys_.empty(); }
139 const_iterator
find(
Key key)
const {
return std::find(begin(),
end(), key); }
145 const_iterator
begin()
const {
return keys_.begin(); }
148 const_iterator
end()
const {
return keys_.end(); }
159 size_t size()
const {
return keys_.size(); }
168 const std::string&
s =
"Factor",
172 virtual void printKeys(
173 const std::string&
s =
"Factor",
187 iterator
begin() {
return keys_.begin(); }
190 iterator
end() {
return keys_.end(); }
195 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 199 friend class boost::serialization::access;
200 template<
class Archive>
201 void serialize(Archive & ar,
const unsigned int ) {
202 ar & BOOST_SERIALIZATION_NVP(keys_);
void print(const Matrix &A, const string &s, ostream &stream)
const gtsam::Symbol key('X', 0)
bool empty() const
Whether the factor is empty (involves zero variables).
Typedefs for easier changing of types.
FastSet< FactorIndex > FactorIndexSet
std::string serialize(const T &input)
serializes to a string
static Factor FromKeys(const CONTAINER &keys)
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
KeyVector keys_
The keys involved in this factor.
static const KeyFormatter DefaultKeyFormatter
static const symbolic::SymbolExpr< internal::symbolic_last_tag > last
const KeyFormatter & formatter
const_iterator find(Key key) const
find
Key back() const
Last key.
FastVector< FactorIndex > FactorIndices
Define collection types:
const_iterator end() const
KeyVector::iterator iterator
Iterator over keys.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::shared_ptr< Factor > shared_ptr
A shared_ptr to this class.
Factor(ITERATOR first, ITERATOR last)
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
A thin wrapper around std::vector that uses a custom allocator.
Key front() const
First key.
static EIGEN_DEPRECATED const end_t end
const KeyVector & keys() const
Access the factor's involved variable keys.
static Factor FromIterators(ITERATOR first, ITERATOR last)
KeyVector::const_iterator const_iterator
Const iterator over keys.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Factor(const CONTAINER &keys)
const_iterator begin() const
std::uint64_t Key
Integer nonlinear key type.