29 #include <boost/shared_ptr.hpp> 30 #include <boost/assign/std/list.hpp> 36 using namespace gtsam;
51 expected += 4,5,3,2,1;
53 list<Key> actual = predecessorMap2Keys<Key>(p_map);
54 LONGS_EQUAL((
long)expected.size(), (long)actual.size());
56 list<Key>::const_iterator it1 = expected.begin();
57 list<Key>::const_iterator it2 = actual.begin();
58 for(; it1!=expected.end(); it1++, it2++)
68 map<Key, SVertex> key2vertex;
74 boost::tie(graph, root, key2vertex) = predecessorMap2Graph<SGraph<Key>, SVertex,
Key>(p_map);
77 CHECK(root == key2vertex[2]);
85 Pose2 p1(1.0, 2.0, 0.3),
p2(4.0, 5.0, 0.6),
p3(7.0, 8.0, 0.9),
p4(2.0, 2.0, 2.9);
99 boost::shared_ptr<Values> actual = composePoses<NonlinearFactorGraph, BetweenFactor<Pose2>,
Pose2,
Key> (
graph, tree, rootPose);
102 expected.insert(1,
p1);
103 expected.insert(2,
p2);
104 expected.insert(3,
p3);
105 expected.insert(4, p4);
118 using namespace symbol_shorthand;
void insert(const KEY &key, const KEY &parent)
static int runAllTests(TestResult &result)
Factor Graph consisting of non-linear factors.
noiseModel::Diagonal::shared_ptr model
boost::shared_ptr< Values > composePoses(const G &graph, const PredecessorMap< KEY > &tree, const POSE &rootPose)
const mpreal root(const mpreal &x, unsigned long int k, mp_rnd_t r=mpreal::get_default_rnd())
NonlinearFactorGraph graph
void g(const string &key, int i)
Linear Factor Graph where all factors are Gaussians.
#define LONGS_EQUAL(expected, actual)
noiseModel::Diagonal::shared_ptr SharedDiagonal
Graph algorithm using boost library.
boost::tuple< G, V, std::map< KEY, V > > predecessorMap2Graph(const PredecessorMap< KEY > &p_map)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
boost::graph_traits< SGraph< KEY > >::vertex_descriptor Vertex
#define EXPECT_LONGS_EQUAL(expected, actual)
Class between(const Class &g) const
PredecessorMap< KEY > findMinimumSpanningTree(const G &fg)
std::list< KEY > predecessorMap2Keys(const PredecessorMap< KEY > &p_map)
std::uint64_t Key
Integer nonlinear key type.
noiseModel::Base::shared_ptr SharedNoiseModel
TEST(Ordering, predecessorMap2Keys)