Using vector instead of deque in VariableIndex, BayesTree::Nodes, and GaussianISAM::Dims. In practice it appears to be faster due to smart reallocation strategies (still need to investigate whether we should use reserve, resize, or neither).
parent
713cdebc27
commit
06f836c0a7
|
|
@ -92,7 +92,7 @@ namespace gtsam {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Map from indices to Clique */
|
/** Map from indices to Clique */
|
||||||
typedef std::deque<sharedClique> Nodes;
|
typedef std::vector<sharedClique> Nodes;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ void VariableIndex::outputMetisFormat(ostream& os) const {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void VariableIndex::permuteInPlace(const Permutation& permutation) {
|
void VariableIndex::permuteInPlace(const Permutation& permutation) {
|
||||||
// Create new index and move references to data into it in permuted order
|
// Create new index and move references to data into it in permuted order
|
||||||
deque<VariableIndex::Factors> newIndex(this->size());
|
vector<VariableIndex::Factors> newIndex(this->size());
|
||||||
for(Index i = 0; i < newIndex.size(); ++i)
|
for(Index i = 0; i < newIndex.size(); ++i)
|
||||||
newIndex[i].swap(this->index_[permutation[i]]);
|
newIndex[i].swap(this->index_[permutation[i]]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public:
|
||||||
typedef Factors::const_iterator Factor_const_iterator;
|
typedef Factors::const_iterator Factor_const_iterator;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::deque<Factors> index_;
|
std::vector<Factors> index_;
|
||||||
size_t nFactors_; // Number of factors in the original factor graph.
|
size_t nFactors_; // Number of factors in the original factor graph.
|
||||||
size_t nEntries_; // Sum of involved variable counts of each factor.
|
size_t nEntries_; // Sum of involved variable counts of each factor.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ namespace gtsam {
|
||||||
class GaussianISAM : public ISAM<GaussianConditional> {
|
class GaussianISAM : public ISAM<GaussianConditional> {
|
||||||
|
|
||||||
typedef ISAM<GaussianConditional> Super;
|
typedef ISAM<GaussianConditional> Super;
|
||||||
std::deque<size_t, boost::fast_pool_allocator<size_t> > dims_;
|
std::vector<size_t> dims_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef std::deque<size_t, boost::fast_pool_allocator<size_t> > Dims;
|
typedef std::vector<size_t> Dims;
|
||||||
|
|
||||||
/** Create an empty Bayes Tree */
|
/** Create an empty Bayes Tree */
|
||||||
GaussianISAM() : Super() {}
|
GaussianISAM() : Super() {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue