Loading...
Searching...
No Matches
MetisIndex.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/inference/Key.h>
#include <gtsam/inference/FactorGraph.h>
#include <gtsam/base/types.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>
namespace gtsam {
class GTSAM_EXPORT MetisIndex {
public:
typedef boost::shared_ptr<MetisIndex> shared_ptr;
typedef boost::bimap<Key, int32_t> bm_type;
private:
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
boost::bimap<Key, int32_t> intKeyBMap_; // Stores Key <-> integer value relationship
size_t nKeys_;
public:
MetisIndex() :
nKeys_(0) {
}
template<class FACTORGRAPH>
MetisIndex(const FACTORGRAPH& factorGraph) :
nKeys_(0) {
augment(factorGraph);
}
~MetisIndex() {
}
template<class FACTORGRAPH>
void augment(const FACTORGRAPH& factors);
const std::vector<int32_t>& xadj() const {
return xadj_;
}
const std::vector<int32_t>& adj() const {
return adj_;
}
size_t nValues() const {
return nKeys_;
}
Key intToKey(int32_t value) const {
assert(value >= 0);
return intKeyBMap_.right.find(value)->second;
}
};
} // \ namesace gtsam
#include <gtsam/inference/MetisIndex-inl.h>
timing.h
Timing utilities.
types.h
Typedefs for easier changing of types.
FactorGraph.h
Factor Graph Base Class.
Key.h
MetisIndex-inl.h
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:100
gtsam::MetisIndex
The MetisIndex class converts a factor graph into the Compressed Sparse Row format for use in METIS a...
Definition MetisIndex.h:45
gtsam::MetisIndex::MetisIndex
MetisIndex()
Default constructor, creates empty MetisIndex.
Definition MetisIndex.h:61