Slight refactor
parent
a38a0ae9e1
commit
7e069191e5
|
|
@ -50,14 +50,9 @@ public:
|
||||||
boost::optional<std::vector<Matrix>&> H = boost::none) const {
|
boost::optional<std::vector<Matrix>&> H = boost::none) const {
|
||||||
if (H) {
|
if (H) {
|
||||||
assert(H->size()==size());
|
assert(H->size()==size());
|
||||||
typedef std::map<Key, Matrix> MapType;
|
|
||||||
MapType terms;
|
|
||||||
Augmented<T> augmented = expression_.augmented(x);
|
Augmented<T> augmented = expression_.augmented(x);
|
||||||
// move terms to H, which is pre-allocated to correct size
|
// move terms to H, which is pre-allocated to correct size
|
||||||
size_t j = 0;
|
augmented.move(*H);
|
||||||
MapType::iterator it = augmented.jacobians().begin();
|
|
||||||
for (; it != augmented.jacobians().end(); ++it)
|
|
||||||
it->second.swap((*H)[j++]);
|
|
||||||
return measurement_.localCoordinates(augmented.value());
|
return measurement_.localCoordinates(augmented.value());
|
||||||
} else {
|
} else {
|
||||||
const T& value = expression_.value(x);
|
const T& value = expression_.value(x);
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,16 @@ public:
|
||||||
<< "x" << term.second.cols() << ") ";
|
<< "x" << term.second.cols() << ") ";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Move terms to array, destroys content
|
||||||
|
void move(std::vector<Matrix>& H) {
|
||||||
|
assert(H.size()==jacobains.size());
|
||||||
|
size_t j = 0;
|
||||||
|
JacobianMap::iterator it = jacobians_.begin();
|
||||||
|
for (; it != jacobians_.end(); ++it)
|
||||||
|
it->second.swap(H[j++]);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue