Added a single-element update() for LieConfig
parent
0b5ebba67e
commit
3df1f69e6c
|
@ -91,6 +91,11 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class J, class T>
|
||||||
|
void LieConfig<J,T>::update(const J& j, const T& val) {
|
||||||
|
values_[j] = val;
|
||||||
|
}
|
||||||
|
|
||||||
template<class J, class T>
|
template<class J, class T>
|
||||||
std::list<J> LieConfig<J,T>::keys() const {
|
std::list<J> LieConfig<J,T>::keys() const {
|
||||||
std::list<J> ret;
|
std::list<J> ret;
|
||||||
|
|
|
@ -100,6 +100,9 @@ namespace gtsam {
|
||||||
/** update the current available values without adding new ones */
|
/** update the current available values without adding new ones */
|
||||||
void update(const LieConfig& cfg);
|
void update(const LieConfig& cfg);
|
||||||
|
|
||||||
|
/** single element change of existing element */
|
||||||
|
void update(const J& j, const T& val);
|
||||||
|
|
||||||
/** Remove a variable from the config */
|
/** Remove a variable from the config */
|
||||||
void erase(const J& j);
|
void erase(const J& j);
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,22 @@ TEST( LieConfig, insert_config )
|
||||||
CHECK(assert_equal(cfg1, expected));
|
CHECK(assert_equal(cfg1, expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST( LieConfig, insert_overlap )
|
||||||
|
{
|
||||||
|
LieConfig<string,Vector> cfg;
|
||||||
|
Vector v1 = Vector_(3, 5.0, 6.0, 7.0);
|
||||||
|
Vector v2 = Vector_(3, 8.0, 9.0, 1.0);
|
||||||
|
|
||||||
|
cfg.insert("x1", v1);
|
||||||
|
CHECK(cfg.size() == 1);
|
||||||
|
CHECK(assert_equal(v1, cfg.at("x1")));
|
||||||
|
|
||||||
|
cfg.update("x1", v2);
|
||||||
|
CHECK(cfg.size() == 1);
|
||||||
|
CHECK(assert_equal(v2, cfg.at("x1"))); // fails - need to change behavior
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST(LieConfig, dim_zero)
|
TEST(LieConfig, dim_zero)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue