Made LieValues allow for values to not be on the linear side during expmap
parent
7bfbb6b829
commit
9ac20eea8a
|
|
@ -148,8 +148,11 @@ namespace gtsam {
|
|||
BOOST_FOREACH(const KeyValue& value, this->values_) {
|
||||
const J& j = value.first;
|
||||
const typename J::Value& pj = value.second;
|
||||
const Vector& dj = delta[ordering[j]];
|
||||
newValues.insert(j, pj.expmap(dj));
|
||||
Index index;
|
||||
if(ordering.tryAt(j,index)) {
|
||||
newValues.insert(j, pj.expmap(delta[index]));
|
||||
} else
|
||||
newValues.insert(j, pj);
|
||||
}
|
||||
return newValues;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,10 +206,12 @@ namespace gtsam {
|
|||
std::vector<size_t> dimensions;
|
||||
_ValuesDimensionCollector(const Ordering& _ordering) : ordering(_ordering), dimensions(_ordering.nVars()) {}
|
||||
template<typename I> void operator()(const I& key_value) {
|
||||
Index var = ordering[key_value->first];
|
||||
Index var;
|
||||
if(ordering.tryAt(key_value->first, var)) {
|
||||
assert(var < dimensions.size());
|
||||
dimensions[var] = key_value->second.dim();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
|
|
@ -64,6 +64,14 @@ public:
|
|||
|
||||
Index& at(const Symbol& key) { return operator[](key); }
|
||||
Index at(const Symbol& key) const { return operator[](key); }
|
||||
bool tryAt(const Symbol& key, Index& index) const {
|
||||
const_iterator i = order_.find(key);
|
||||
if(i != order_.end()) {
|
||||
index = i->second;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
Index& operator[](const Symbol& key) {
|
||||
iterator i=order_.find(key); assert(i != order_.end()); return i->second; }
|
||||
Index operator[](const Symbol& key) const {
|
||||
|
|
|
|||
Loading…
Reference in New Issue