23 #include <boost/assign/std/list.hpp> 24 #include <boost/assign/std/set.hpp> 30 using namespace gtsam;
91 list<int>
keys; keys += 5, 6, 7;
112 map<int, set<int> > sets = dsf.
sets();
115 set<int>
expected; expected += 5, 6;
127 map<int, set<int> > sets = dsf.
sets();
130 set<int>
expected; expected += 5, 6, 7;
141 map<int, set<int> > sets = dsf.
sets();
144 set<int>
expected; expected += 5, 6;
155 list<int>
keys; keys += 5;
156 map<int, set<int> > partitions = dsf.
partition(keys);
171 list<int>
keys; keys += 7;
172 map<int, set<int> > partitions = dsf.
partition(keys);
187 list<int>
keys; keys += 5, 7;
188 map<int, set<int> > partitions = dsf.
partition(keys);
202 set<int>
set = dsf.
set(5);
205 std::set<int>
expected; expected += 5, 6;
217 set<int>
set = dsf.
set(5);
220 std::set<int>
expected; expected += 5, 6, 7;
225 int func(
const int&
a) {
return a + 10; }
235 expected = expected.
makeSet(15);
236 expected = expected.
makeSet(16);
237 expected = expected.
makeSet(17);
239 EXPECT(actual == expected);
258 EXPECT(actual == expected);
263 static string x1(
"x1"),
x2(
"x2"),
x3(
"x3"),
x4(
"x4");
284 Measurement m11(1,1),m12(1,2),m14(1,4);
285 Measurement m22(2,2),m23(2,3),m25(2,5),m26(2,6);
288 list<Measurement> measurements;
289 measurements += m11,m12,m14, m22,m23,m25,m26;
292 typedef pair<Measurement,Measurement> Match;
294 matches += Match(m11,m22), Match(m12,m23), Match(m14,m25), Match(m14,m26);
298 for(
const Match&
m: matches)
313 set<Measurement> expected1; expected1 += m11,m22;
314 set<Measurement> actual1 = dsf.
set(m11);
315 EXPECT(expected1 == actual1);
317 set<Measurement> expected2; expected2 += m12,m23;
318 set<Measurement> actual2 = dsf.
set(m12);
319 EXPECT(expected2 == actual2);
321 set<Measurement> expected3; expected3 += m14,m25,m26;
322 set<Measurement> actual3 = dsf.
set(m14);
323 EXPECT(expected3 == actual3);
DSF map(boost::function< KEY(const KEY &)> func) const
Self makePair(const KEY &key1, const KEY &key2) const
KEY findSet(const KEY &key) const
static int runAllTests(TestResult &result)
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
Self makeSet(const KEY &key) const
std::map< KEY, Set > partition(const std::list< KEY > &keys) const
Self makeList(const std::list< KEY > &keys) const
Set set(const KEY &label) const
void makeUnionInPlace(const KEY &key1, const KEY &key2)
GenericMeasurement< Point2, Point2 > Measurement
#define EXPECT(condition)
An implementation of Disjoint set forests (see CLR page 446 and up)
Pose3 x3(Rot3::Ypr(M_PI/4.0, 0.0, 0.0), l2)
#define LONGS_EQUAL(expected, actual)
#define EXPECT_LONGS_EQUAL(expected, actual)
Self makeUnion(const KEY &key1, const KEY &key2) const
std::map< KEY, Set > sets() const