Return FastSet instead of std::set from NonlinearFactorGraph::keys()

release/4.3a0
Richard Roberts 2012-06-30 22:32:46 +00:00
parent f06c7ad2e9
commit 86f19362ab
3 changed files with 5 additions and 5 deletions

View File

@ -54,8 +54,8 @@ double NonlinearFactorGraph::error(const Values& c) const {
}
/* ************************************************************************* */
std::set<Key> NonlinearFactorGraph::keys() const {
std::set<Key> keys;
FastSet<Key> NonlinearFactorGraph::keys() const {
FastSet<Key> keys;
BOOST_FOREACH(const sharedFactor& factor, this->factors_) {
if(factor)
keys.insert(factor->begin(), factor->end());

View File

@ -47,7 +47,7 @@ namespace gtsam {
void print(const std::string& str = "NonlinearFactorGraph: ", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
/** return keys as an ordered set - ordering is by key value */
std::set<Key> keys() const;
FastSet<Key> keys() const;
/** unnormalized error, \f$ 0.5 \sum_i (h_i(X_i)-z)^2/\sigma^2 \f$ in the most common case */
double error(const Values& c) const;

View File

@ -65,9 +65,9 @@ TEST( Graph, error )
TEST( Graph, keys )
{
Graph fg = createNonlinearFactorGraph();
set<Key> actual = fg.keys();
FastSet<Key> actual = fg.keys();
LONGS_EQUAL(3, actual.size());
set<Key>::const_iterator it = actual.begin();
FastSet<Key>::const_iterator it = actual.begin();
LONGS_EQUAL(L(1), *(it++));
LONGS_EQUAL(X(1), *(it++));
LONGS_EQUAL(X(2), *(it++));