Merged in easymile_cyril/gtsam/fix/zero-dim-factor (pull request #319)

Allow zero dimension factors
release/4.3a0
Cyril Roussillon 2018-10-10 11:20:49 +00:00 committed by Frank Dellaert
commit 84442f99f2
2 changed files with 3 additions and 6 deletions

View File

@ -70,9 +70,6 @@ Scatter::Scatter(const GaussianFactorGraph& gfg,
iterator first = begin();
if (ordering) first += ordering->size();
if (first != end()) std::sort(first, end());
// Filter out keys with zero dimensions (if ordering had more keys)
erase(std::remove_if(begin(), end(), SlotEntry::Zero), end());
}
/* ************************************************************************* */

View File

@ -113,9 +113,9 @@ struct LevenbergMarquardtState : public NonlinearOptimizerState {
// Small cache of A|b|model indexed by dimension. Can save many mallocs.
mutable std::vector<CachedModel> noiseModelCache;
CachedModel* getCachedModel(size_t dim) const {
if (dim > noiseModelCache.size())
noiseModelCache.resize(dim);
CachedModel* item = &noiseModelCache[dim - 1];
if (dim >= noiseModelCache.size())
noiseModelCache.resize(dim+1);
CachedModel* item = &noiseModelCache[dim];
if (!item->model)
*item = CachedModel(dim, 1.0 / std::sqrt(lambda));
return item;