Replace boost::bimap
parent
0ee985b629
commit
438e29353d
|
@ -44,7 +44,7 @@ void MetisIndex::augment(const FACTORGRAPH& factors) {
|
||||||
for(const Key& key: *factors[i]) {
|
for(const Key& key: *factors[i]) {
|
||||||
keySet.insert(keySet.end(), key); // Keep a track of all unique keys
|
keySet.insert(keySet.end(), key); // Keep a track of all unique keys
|
||||||
if (intKeyBMap_.left.find(key) == intKeyBMap_.left.end()) {
|
if (intKeyBMap_.left.find(key) == intKeyBMap_.left.end()) {
|
||||||
intKeyBMap_.insert(bm_type::value_type(key, keyCounter));
|
intKeyBMap_.insert(key, keyCounter);
|
||||||
keyCounter++;
|
keyCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,17 +22,9 @@
|
||||||
#include <gtsam/base/types.h>
|
#include <gtsam/base/types.h>
|
||||||
#include <gtsam/base/timing.h>
|
#include <gtsam/base/timing.h>
|
||||||
|
|
||||||
// Boost bimap generates many ugly warnings in CLANG
|
|
||||||
#ifdef __clang__
|
|
||||||
# pragma clang diagnostic push
|
|
||||||
# pragma clang diagnostic ignored "-Wredeclared-class-member"
|
|
||||||
#endif
|
|
||||||
#include <boost/bimap.hpp>
|
|
||||||
#ifdef __clang__
|
|
||||||
# pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
/**
|
/**
|
||||||
|
@ -45,12 +37,21 @@ namespace gtsam {
|
||||||
class GTSAM_EXPORT MetisIndex {
|
class GTSAM_EXPORT MetisIndex {
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<MetisIndex> shared_ptr;
|
typedef std::shared_ptr<MetisIndex> shared_ptr;
|
||||||
typedef boost::bimap<Key, int32_t> bm_type;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Stores Key <-> integer value relationship
|
||||||
|
struct BiMap {
|
||||||
|
std::map<Key, int32_t> left;
|
||||||
|
std::unordered_map<int32_t, Key> right;
|
||||||
|
void insert(const Key& left_value, const int32_t& right_value) {
|
||||||
|
left[left_value] = right_value;
|
||||||
|
right[right_value] = left_value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
std::vector<int32_t> xadj_; // Index of node's adjacency list in adj
|
std::vector<int32_t> xadj_; // Index of node's adjacency list in adj
|
||||||
std::vector<int32_t> adj_; // Stores ajacency lists of all nodes, appended into a single vector
|
std::vector<int32_t> adj_; // Stores ajacency lists of all nodes, appended into a single vector
|
||||||
boost::bimap<Key, int32_t> intKeyBMap_; // Stores Key <-> integer value relationship
|
BiMap intKeyBMap_; // Stores Key <-> integer value relationship
|
||||||
size_t nKeys_;
|
size_t nKeys_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue