Merged develop into feature branch, fixed Rot3 merge conflict.

release/4.3a0
Alex Trevor 2014-01-22 09:12:52 -05:00
commit 2b77116e08
31 changed files with 4865 additions and 4825 deletions

View File

@ -200,6 +200,18 @@ namespace gtsam {
* not found. */
const_iterator find(Key j) const { return boost::make_transform_iterator(values_.find(j), &make_const_deref_pair); }
/** Find the element greater than or equal to the specified key. */
iterator lower_bound(Key j) { return boost::make_transform_iterator(values_.lower_bound(j), &make_deref_pair); }
/** Find the element greater than or equal to the specified key. */
const_iterator lower_bound(Key j) const { return boost::make_transform_iterator(values_.lower_bound(j), &make_const_deref_pair); }
/** Find the lowest-ordered element greater than the specified key. */
iterator upper_bound(Key j) { return boost::make_transform_iterator(values_.upper_bound(j), &make_deref_pair); }
/** Find the lowest-ordered element greater than the specified key. */
const_iterator upper_bound(Key j) const { return boost::make_transform_iterator(values_.upper_bound(j), &make_const_deref_pair); }
/** The number of variables in this config */
size_t size() const { return values_.size(); }

View File

@ -149,6 +149,34 @@ TEST( Values, update_element )
CHECK(assert_equal(v2, cfg.at<LieVector>(key1)));
}
/* ************************************************************************* */
TEST(Values, basic_functions)
{
Values values;
const Values& values_c = values;
values.insert(2, LieVector());
values.insert(4, LieVector());
values.insert(6, LieVector());
values.insert(8, LieVector());
// find
EXPECT_LONGS_EQUAL(4, values.find(4)->key);
EXPECT_LONGS_EQUAL(4, values_c.find(4)->key);
// lower_bound
EXPECT_LONGS_EQUAL(4, values.lower_bound(4)->key);
EXPECT_LONGS_EQUAL(4, values_c.lower_bound(4)->key);
EXPECT_LONGS_EQUAL(4, values.lower_bound(3)->key);
EXPECT_LONGS_EQUAL(4, values_c.lower_bound(3)->key);
// upper_bound
EXPECT_LONGS_EQUAL(6, values.upper_bound(4)->key);
EXPECT_LONGS_EQUAL(6, values_c.upper_bound(4)->key);
EXPECT_LONGS_EQUAL(4, values.upper_bound(3)->key);
EXPECT_LONGS_EQUAL(4, values_c.upper_bound(3)->key);
}
///* ************************************************************************* */
//TEST(Values, dim_zero)
//{