24 #include <boost/serialization/nvp.hpp> 82 template<
typename CONTAINER>
83 explicit Factor(
const CONTAINER&
keys) : keys_(keys.begin(), keys.
end()) {}
87 template<
typename ITERATOR>
92 template<
typename CONTAINER>
94 return Factor(keys.begin(), keys.end()); }
98 template<
typename ITERATOR>
100 return Factor(first, last); }
109 virtual ~
Factor() =
default;
121 const_iterator
find(
Key key)
const {
return std::find(begin(),
end(), key); }
127 const_iterator
begin()
const {
return keys_.begin(); }
130 const_iterator
end()
const {
return keys_.end(); }
135 size_t size()
const {
return keys_.size(); }
144 const std::string&
s =
"Factor",
148 virtual void printKeys(
149 const std::string&
s =
"Factor",
154 bool equals(
const This& other,
double tol = 1
e-9)
const;
166 iterator
begin() {
return keys_.begin(); }
169 iterator
end() {
return keys_.end(); }
173 friend class boost::serialization::access;
174 template<
class Archive>
176 ar & BOOST_SERIALIZATION_NVP(keys_);
void print(const Matrix &A, const string &s, ostream &stream)
constexpr int last(int, int result)
Typedefs for easier changing of types.
const_iterator find(Key key) const
find
FastSet< FactorIndex > FactorIndexSet
FastVector< FactorIndex > FactorIndices
Define collection types:
static Factor FromKeys(const CONTAINER &keys)
const_iterator end() const
KeyVector keys_
The keys involved in this factor.
static const KeyFormatter DefaultKeyFormatter
const KeyFormatter & formatter
void serialize(Archive &ar, const unsigned int)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
constexpr int first(int i)
Implementation details for constexpr functions.
Key back() const
Last key.
Key front() const
First key.
const_iterator begin() const
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
KeyVector::iterator iterator
Iterator over keys.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Factor(ITERATOR first, ITERATOR last)
A thin wrapper around std::vector that uses a custom allocator.
boost::shared_ptr< Factor > shared_ptr
A shared_ptr to this class.
const KeyVector & keys() const
Access the factor's involved variable keys.
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
static Factor FromIterators(ITERATOR first, ITERATOR last)
KeyVector::const_iterator const_iterator
Const iterator over keys.
Factor(const CONTAINER &keys)
std::uint64_t Key
Integer nonlinear key type.