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).

release/4.3a0
Richard Roberts 2012-11-23 23:22:46 +00:00
parent 713cdebc27
commit 06f836c0a7
4 changed files with 5 additions and 5 deletions

View File

@ -92,7 +92,7 @@ namespace gtsam {
};
/** Map from indices to Clique */
typedef std::deque<sharedClique> Nodes;
typedef std::vector<sharedClique> Nodes;
protected:

View File

@ -68,7 +68,7 @@ void VariableIndex::outputMetisFormat(ostream& os) const {
/* ************************************************************************* */
void VariableIndex::permuteInPlace(const Permutation& permutation) {
// 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)
newIndex[i].swap(this->index_[permutation[i]]);

View File

@ -48,7 +48,7 @@ public:
typedef Factors::const_iterator Factor_const_iterator;
protected:
std::deque<Factors> index_;
std::vector<Factors> index_;
size_t nFactors_; // Number of factors in the original factor graph.
size_t nEntries_; // Sum of involved variable counts of each factor.

View File

@ -30,11 +30,11 @@ namespace gtsam {
class GaussianISAM : public ISAM<GaussianConditional> {
typedef ISAM<GaussianConditional> Super;
std::deque<size_t, boost::fast_pool_allocator<size_t> > dims_;
std::vector<size_t> dims_;
public:
typedef std::deque<size_t, boost::fast_pool_allocator<size_t> > Dims;
typedef std::vector<size_t> Dims;
/** Create an empty Bayes Tree */
GaussianISAM() : Super() {}