added erase method
parent
d6c2b415a5
commit
d0d2aa8aee
|
|
@ -118,6 +118,9 @@ public:
|
||||||
return As_.at(key);
|
return As_.at(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** erase the A associated with the input key */
|
||||||
|
size_t erase_A(const Symbol& key) { return As_.erase(key); }
|
||||||
|
|
||||||
/** operator[] syntax for get */
|
/** operator[] syntax for get */
|
||||||
inline const Matrix& operator[](const Symbol& name) const {
|
inline const Matrix& operator[](const Symbol& name) const {
|
||||||
return get_A(name);
|
return get_A(name);
|
||||||
|
|
|
||||||
|
|
@ -803,6 +803,24 @@ TEST ( GaussianFactor, exploding_MAST_factor ) {
|
||||||
CHECK(true);
|
CHECK(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST( GaussianFactor, erase)
|
||||||
|
{
|
||||||
|
Vector b = Vector_(3, 1., 2., 3.);
|
||||||
|
SharedDiagonal noise = noiseModel::Diagonal::Sigmas(Vector_(3,1.,1.,1.));
|
||||||
|
Symbol x0('x',0), x1('x',1);
|
||||||
|
std::list<std::pair<Symbol, Matrix> > terms;
|
||||||
|
terms.push_back(make_pair(x0, eye(2)));
|
||||||
|
terms.push_back(make_pair(x1, 2.*eye(2)));
|
||||||
|
|
||||||
|
GaussianFactor actual(terms, b, noise);
|
||||||
|
int erased = actual.erase_A(x0);
|
||||||
|
|
||||||
|
LONGS_EQUAL(1, erased);
|
||||||
|
GaussianFactor expected(x1, 2.*eye(2), b, noise);
|
||||||
|
CHECK(assert_equal(expected, actual));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
|
int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue