Return FastSet instead of std::set from NonlinearFactorGraph::keys()
parent
f06c7ad2e9
commit
86f19362ab
|
|
@ -54,8 +54,8 @@ double NonlinearFactorGraph::error(const Values& c) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
std::set<Key> NonlinearFactorGraph::keys() const {
|
FastSet<Key> NonlinearFactorGraph::keys() const {
|
||||||
std::set<Key> keys;
|
FastSet<Key> keys;
|
||||||
BOOST_FOREACH(const sharedFactor& factor, this->factors_) {
|
BOOST_FOREACH(const sharedFactor& factor, this->factors_) {
|
||||||
if(factor)
|
if(factor)
|
||||||
keys.insert(factor->begin(), factor->end());
|
keys.insert(factor->begin(), factor->end());
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ namespace gtsam {
|
||||||
void print(const std::string& str = "NonlinearFactorGraph: ", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
|
void print(const std::string& str = "NonlinearFactorGraph: ", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
|
||||||
|
|
||||||
/** return keys as an ordered set - ordering is by key value */
|
/** 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 */
|
/** 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;
|
double error(const Values& c) const;
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ TEST( Graph, error )
|
||||||
TEST( Graph, keys )
|
TEST( Graph, keys )
|
||||||
{
|
{
|
||||||
Graph fg = createNonlinearFactorGraph();
|
Graph fg = createNonlinearFactorGraph();
|
||||||
set<Key> actual = fg.keys();
|
FastSet<Key> actual = fg.keys();
|
||||||
LONGS_EQUAL(3, actual.size());
|
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(L(1), *(it++));
|
||||||
LONGS_EQUAL(X(1), *(it++));
|
LONGS_EQUAL(X(1), *(it++));
|
||||||
LONGS_EQUAL(X(2), *(it++));
|
LONGS_EQUAL(X(2), *(it++));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue