31 using namespace gtsam;
33 int main(
int argc,
char* argv[]) {
36 ofstream
os(
"dsf-timing.csv");
37 os <<
"images,points,matches,Base,Map,BTree" << endl;
40 vector<size_t>
ms {10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 1000};
44 volatile size_t n = 500;
45 volatile size_t N =
m *
n;
47 volatile double fm = 0.1;
48 volatile size_t np = fm *
m *
m / 2;
49 volatile double fpm = 0.5;
50 volatile size_t nm = fpm * n *
np;
52 cout <<
"\nTesting with " << (
int)
m <<
" images, " << (
int)N <<
" points, " << (
int)nm <<
" matches\n";
53 cout <<
"Generating " << nm <<
" matches" << endl;
55 std::uniform_int_distribution<> rn(0, N - 1);
57 typedef pair<size_t, size_t> Match;
60 for (
size_t k = 0; k < nm; k++)
61 matches.push_back(Match(rn(rng), rn(rng)));
63 os << (
int)
m <<
"," << (
int)N <<
"," << (
int)nm <<
",";
70 for(
const Match&
m: matches)
74 dsftime = dsftimeNode->secs();
76 cout <<
"DSFBase: " << dsftime <<
" s" << endl;
85 for(
const Match&
m: matches)
89 dsftime = dsftimeNode->secs();
90 os << dsftime << endl;
91 cout <<
"DSFMap: " << dsftime <<
" s" << endl;
100 for (
size_t j = 0;
j <
N;
j++)
102 for(
const Match&
m: matches)
106 dsftime = dsftimeNode->secs();
107 os << dsftime << endl;
108 cout <<
"DSF functional: " << dsftime <<
" s" << endl;
117 for (
size_t j = 0;
j <
N;
j++)
119 for(
const Match&
m: matches)
123 dsftime = dsftimeNode->secs();
124 os << dsftime <<
",";
125 cout <<
"DSF in-place: " << dsftime <<
" s" << endl;
#define tictoc_getNode(variable, label)
void merge(const KEY &x, const KEY &y)
Merge two sets.
void makeSetInPlace(const KEY &key)
A faster implementation for DSF, which uses vector rather than btree.
void makeUnionInPlace(const KEY &key1, const KEY &key2)
Self makeUnion(const KEY &key1, const KEY &key2) const
Self makeSet(const KEY &key) const
An implementation of Disjoint set forests (see CLR page 446 and up)
int main(int argc, char *argv[])
ofstream os("timeSchurFactors.csv")
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...
Allow for arbitrary type in DSF.