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

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