Fixed 2nd expmap template, which now creates a VectorConfig and calls the first template

release/4.3a0
Frank Dellaert 2010-01-10 16:16:03 +00:00
parent 65e4dc1342
commit 4a21fb9387
1 changed files with 23 additions and 24 deletions

View File

@ -37,32 +37,31 @@ namespace gtsam {
template<class T> template<class T>
LieConfig<T> expmap(const LieConfig<T>& c, const VectorConfig& delta) { LieConfig<T> expmap(const LieConfig<T>& c, const VectorConfig& delta) {
LieConfig<T> newConfig; LieConfig<T> newConfig;
string j; T pj; string j; T pj;
FOREACH_PAIR(j, pj, c.values_) { FOREACH_PAIR(j, pj, c) {
if (delta.contains(j)) { if (delta.contains(j)) {
const Vector& dj = delta[j]; const Vector& dj = delta[j];
//check_size(j,vj,dj); newConfig.insert(j, expmap(pj,dj));
newConfig.insert(j, expmap(pj,dj)); } else
} else newConfig.insert(j, pj);
newConfig.insert(j, pj); }
} return newConfig;
return newConfig; }
}
// This version just creates a VectorConfig then calls function above
template<class T> template<class T>
LieConfig<T> expmap(const LieConfig<T>& c, const Vector& delta) { LieConfig<T> expmap(const LieConfig<T>& c, const Vector& delta) {
LieConfig<T> newConfig; VectorConfig deltaConfig;
pair<string, Vector> value; int delta_offset = 0;
int delta_offset = 0; string j; T pj;
BOOST_FOREACH(value, c) { FOREACH_PAIR(j, pj, c) {
int cur_dim = dim(value.second); int cur_dim = dim(pj);
newConfig.insert(value.first, Vector dj = sub(delta, delta_offset, delta_offset+cur_dim);
expmap(value.second, deltaConfig.insert(j,dj);
sub(delta, delta_offset, delta_offset+cur_dim))); delta_offset += cur_dim;
delta_offset += cur_dim; }
} return expmap(c,deltaConfig);
return newConfig; }
}
} }