28 #ifdef GTSAM_USE_BOOST_FEATURES 29 #include <boost/assign/list_inserter.hpp> 59 template<
typename KEYS>
61 Base(keys.begin(), keys.
end()) {
64 #ifdef GTSAM_USE_BOOST_FEATURES 65 boost::assign::list_inserter<boost::assign_detail::call_push_back<This> >
operator+=(
69 return boost::assign::make_list_inserter(
70 boost::assign_detail::call_push_back<This>(*
this))(
key);
99 template<
class FACTOR_GRAPH>
118 template<
class FACTOR_GRAPH>
120 const KeyVector& constrainLast,
bool forceOrder =
false) {
135 bool forceOrder =
false);
145 template<
class FACTOR_GRAPH>
147 const KeyVector& constrainFirst,
bool forceOrder =
false) {
163 const KeyVector& constrainFirst,
bool forceOrder =
false);
174 template<
class FACTOR_GRAPH>
194 template<
class FACTOR_GRAPH>
198 std::stable_sort(keys.begin(), keys.end());
199 return Ordering(keys.begin(), keys.end());
203 template<
class FACTOR_GRAPH>
205 std::vector<int>& adj,
const FACTOR_GRAPH&
graph);
210 template<
class FACTOR_GRAPH>
223 template<
class FACTOR_GRAPH>
225 const FACTOR_GRAPH& graph) {
229 switch (orderingType) {
237 throw std::runtime_error(
238 "Ordering::Create error: called with CUSTOM ordering type.");
240 throw std::runtime_error(
241 "Ordering::Create error: called with unknown ordering type.");
262 const VariableIndex& variableIndex, std::vector<int>& cmember);
264 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 266 friend class boost::serialization::access;
267 template<
class ARCHIVE>
269 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
const gtsam::Symbol key('X', 0)
static GTSAM_EXPORT Ordering Metis(const MetisIndex &met)
Compute an ordering determined by METIS from a VariableIndex.
static Ordering Create(OrderingType orderingType, const FACTOR_GRAPH &graph)
std::string serialize(const T &input)
serializes to a string
This & operator+=(KeyVector &keys)
Append new keys to the ordering as ordering += keys.
Ordering(const KEYS &keys)
Create from a container.
NonlinearFactorGraph graph
static GTSAM_EXPORT void CSRFormat(std::vector< int > &xadj, std::vector< int > &adj, const FACTOR_GRAPH &graph)
METIS Formatting function.
static const KeyFormatter DefaultKeyFormatter
GTSAM_EXPORT Ordering()
Create an empty ordering.
static Ordering Colamd(const FACTOR_GRAPH &graph)
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static Ordering ColamdConstrainedFirst(const FACTOR_GRAPH &graph, const KeyVector &constrainFirst, bool forceOrder=false)
OrderingType
Type of ordering to use.
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
static Ordering ColamdConstrained(const FACTOR_GRAPH &graph, const FastMap< Key, int > &groups)
GTSAM_EXPORT bool equals(const Ordering &other, double tol=1e-9) const
static Ordering Metis(const FACTOR_GRAPH &graph)
GTSAM_EXPORT void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
static EIGEN_DEPRECATED const end_t end
bool contains(const Key &key) const
Check if key exists in ordering.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
FastMap< Key, size_t > invert() const
Invert (not reverse) the ordering - returns a map from key to order position.
static Ordering ColamdConstrainedLast(const FACTOR_GRAPH &graph, const KeyVector &constrainLast, bool forceOrder=false)
A thin wrapper around std::set that uses boost's fast_pool_allocator.
static Ordering Natural(const FACTOR_GRAPH &fg)
Return a natural Ordering. Typically used by iterative solvers.
std::uint64_t Key
Integer nonlinear key type.
Ordering This
Typedef to this class.