Merged in easymile_cyril/gtsam/fix/zero-dim-factor (pull request #319)
Allow zero dimension factorsrelease/4.3a0
commit
84442f99f2
|
@ -70,9 +70,6 @@ Scatter::Scatter(const GaussianFactorGraph& gfg,
|
||||||
iterator first = begin();
|
iterator first = begin();
|
||||||
if (ordering) first += ordering->size();
|
if (ordering) first += ordering->size();
|
||||||
if (first != end()) std::sort(first, end());
|
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -113,9 +113,9 @@ struct LevenbergMarquardtState : public NonlinearOptimizerState {
|
||||||
// Small cache of A|b|model indexed by dimension. Can save many mallocs.
|
// Small cache of A|b|model indexed by dimension. Can save many mallocs.
|
||||||
mutable std::vector<CachedModel> noiseModelCache;
|
mutable std::vector<CachedModel> noiseModelCache;
|
||||||
CachedModel* getCachedModel(size_t dim) const {
|
CachedModel* getCachedModel(size_t dim) const {
|
||||||
if (dim > noiseModelCache.size())
|
if (dim >= noiseModelCache.size())
|
||||||
noiseModelCache.resize(dim);
|
noiseModelCache.resize(dim+1);
|
||||||
CachedModel* item = &noiseModelCache[dim - 1];
|
CachedModel* item = &noiseModelCache[dim];
|
||||||
if (!item->model)
|
if (!item->model)
|
||||||
*item = CachedModel(dim, 1.0 / std::sqrt(lambda));
|
*item = CachedModel(dim, 1.0 / std::sqrt(lambda));
|
||||||
return item;
|
return item;
|
||||||
|
|
Loading…
Reference in New Issue