32 using namespace gtsam;
66 typedef pair<size_t,size_t> Match;
67 const vector<Match>
matches{Match(1, 2), Match(2, 3), Match(4, 5),
76 size_t rep1 = 1, rep2 = 4;
87 std::shared_ptr<DSFBase::V>
v = std::make_shared<DSFBase::V>(5);
88 const std::vector<size_t>
keys {1, 3};
98 map<size_t, std::set<size_t> > sets = dsf.
sets();
101 const std::set<size_t>
expected{0, 1};
109 map<size_t, vector<size_t> > arrays = dsf.
arrays();
112 const vector<size_t>
expected{0, 1};
121 map<size_t, std::set<size_t> > sets = dsf.
sets();
124 const std::set<size_t>
expected{0, 1, 2};
133 map<size_t, vector<size_t> > arrays = dsf.
arrays();
136 const vector<size_t>
expected{0, 1, 2};
144 map<size_t, std::set<size_t> > sets = dsf.
sets();
147 const std::set<size_t>
expected{0, 1};
155 map<size_t, vector<size_t> > arrays = dsf.
arrays();
158 const vector<size_t>
expected{0, 1};
166 std::set<size_t>
set = dsf.
set(0);
169 const std::set<size_t>
expected{0, 1};
178 std::set<size_t>
set = dsf.
set(0);
181 const std::set<size_t>
expected{0, 1, 2};
198 const vector<size_t>
keys{1, 2, 3, 4, 5, 6};
201 typedef pair<size_t,size_t> Match;
202 const vector<Match>
matches{Match(1, 2), Match(2, 3), Match(4, 5),
211 map<size_t, std::set<size_t> > sets = dsf.
sets();
213 const std::set<size_t> expected1{1, 2, 3};
214 std::set<size_t> actual1 = sets[dsf.
find(2)];
215 EXPECT(expected1 == actual1);
216 const std::set<size_t> expected2{4, 5, 6};
217 std::set<size_t> actual2 = sets[dsf.
find(5)];
218 EXPECT(expected2 == actual2);
static int runAllTests(TestResult &result)
size_t find(size_t key) const
Find the label of the set in which {key} lives.
A faster implementation for DSF, which uses vector rather than btree.
std::map< size_t, std::vector< size_t > > arrays() const
Return all sets, i.e. a partition of all elements.
#define EXPECT(condition)
Array< int, Dynamic, 1 > v
std::map< size_t, std::set< size_t > > sets() const
Return all sets, i.e. a partition of all elements.
bool isSingleton(const size_t &label) const
Find whether there is one and only one occurrence for the given {label}.
#define LONGS_EQUAL(expected, actual)
std::set< size_t > set(const size_t &label) const
Get the nodes in the tree with the given label.
#define EXPECT_LONGS_EQUAL(expected, actual)
void merge(const size_t &i1, const size_t &i2)
Merge the sets containing i1 and i2. Does nothing if i1 and i2 are already in the same set...
TEST(SmartFactorBase, Pinhole)