testTableFactor.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
12 /*
13  * testTableFactor.cpp
14  *
15  * @date Feb 15, 2023
16  * @author Yoonwoo Kim
17  */
18 
20 #include <gtsam/base/Testable.h>
26 
27 #include <chrono>
28 #include <random>
29 
30 using namespace std;
31 using namespace gtsam;
32 
33 vector<double> genArr(double dropout, size_t size) {
34  random_device rd;
35  mt19937 g(rd());
36  vector<double> dropoutmask(size); // Chance of 0
37 
38  uniform_int_distribution<> dist(1, 9);
39  auto gen = [&dist, &g]() { return dist(g); };
40  generate(dropoutmask.begin(), dropoutmask.end(), gen);
41 
42  fill_n(dropoutmask.begin(), dropoutmask.size() * (dropout), 0);
43  shuffle(dropoutmask.begin(), dropoutmask.end(), g);
44 
45  return dropoutmask;
46 }
47 
48 map<double, pair<chrono::microseconds, chrono::microseconds>> measureTime(
49  DiscreteKeys keys1, DiscreteKeys keys2, size_t size) {
50  vector<double> dropouts = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9};
51  map<double, pair<chrono::microseconds, chrono::microseconds>> measured_times;
52 
53  for (auto dropout : dropouts) {
54  vector<double> arr1 = genArr(dropout, size);
55  vector<double> arr2 = genArr(dropout, size);
56  TableFactor f1(keys1, arr1);
57  TableFactor f2(keys2, arr2);
58  DecisionTreeFactor f1_dt(keys1, arr1);
59  DecisionTreeFactor f2_dt(keys2, arr2);
60 
61  // measure time TableFactor
62  auto tb_start = chrono::high_resolution_clock::now();
63  TableFactor actual = f1 * f2;
64  auto tb_end = chrono::high_resolution_clock::now();
65  auto tb_time_diff =
66  chrono::duration_cast<chrono::microseconds>(tb_end - tb_start);
67 
68  // measure time DT
69  auto dt_start = chrono::high_resolution_clock::now();
70  DecisionTreeFactor actual_dt = f1_dt * f2_dt;
71  auto dt_end = chrono::high_resolution_clock::now();
72  auto dt_time_diff =
73  chrono::duration_cast<chrono::microseconds>(dt_end - dt_start);
74 
75  bool flag = true;
76  for (auto assignmentVal : actual_dt.enumerate()) {
77  flag = actual_dt(assignmentVal.first) != actual(assignmentVal.first);
78  if (flag) {
79  std::cout << "something is wrong: " << std::endl;
80  assignmentVal.first.print();
81  std::cout << "dt: " << actual_dt(assignmentVal.first) << std::endl;
82  std::cout << "tb: " << actual(assignmentVal.first) << std::endl;
83  break;
84  }
85  }
86  if (flag) break;
87  measured_times[dropout] = make_pair(tb_time_diff, dt_time_diff);
88  }
89  return measured_times;
90 }
91 
92 void printTime(map<double, pair<chrono::microseconds, chrono::microseconds>>
93  measured_time) {
94  for (auto&& kv : measured_time) {
95  cout << "dropout: " << kv.first
96  << " | TableFactor time: " << kv.second.first.count()
97  << " | DecisionTreeFactor time: " << kv.second.second.count() << endl;
98  }
99 }
100 
101 /* ************************************************************************* */
102 // Check constructors for TableFactor.
103 TEST(TableFactor, constructors) {
104  // Declare a bunch of keys
105  DiscreteKey X(0, 2), Y(1, 3), Z(2, 2), A(3, 5);
106 
107  // Create factors
108  TableFactor f_zeros(A, {0, 0, 0, 0, 1});
109  TableFactor f1(X, {2, 8});
110  TableFactor f2(X & Y, "2 5 3 6 4 7");
111  TableFactor f3(X & Y & Z, "2 5 3 6 4 7 25 55 35 65 45 75");
112  EXPECT_LONGS_EQUAL(1, f1.size());
113  EXPECT_LONGS_EQUAL(2, f2.size());
114  EXPECT_LONGS_EQUAL(3, f3.size());
115 
117  values[0] = 1; // x
118  values[1] = 2; // y
119  values[2] = 1; // z
120  values[3] = 4; // a
121  EXPECT_DOUBLES_EQUAL(1, f_zeros(values), 1e-9);
122  EXPECT_DOUBLES_EQUAL(8, f1(values), 1e-9);
123  EXPECT_DOUBLES_EQUAL(7, f2(values), 1e-9);
124  EXPECT_DOUBLES_EQUAL(75, f3(values), 1e-9);
125 
126  // Assert that error = -log(value)
127  EXPECT_DOUBLES_EQUAL(-log(f1(values)), f1.error(values), 1e-9);
128 
129  // Construct from DiscreteConditional
130  DiscreteConditional conditional(X | Y = "1/1 2/3 1/4");
131  TableFactor f4(conditional);
132  // Manually constructed via inspection and comparison to DecisionTreeFactor
133  TableFactor expected(X & Y, "0.5 0.4 0.2 0.5 0.6 0.8");
135 
136  // Test for 9=3x3 values.
137  DiscreteKey V(0, 3), W(1, 3), O(100, 3);
138  DiscreteConditional conditional5(V | W = "1/2/3 5/6/7 9/10/11");
139  TableFactor f5(conditional5);
140 
141  std::string expected_values =
142  "0.166667 0.277778 0.3 0.333333 0.333333 0.333333 0.5 0.388889 0.366667";
143  TableFactor expected_f5(V & W, expected_values);
144  EXPECT(assert_equal(expected_f5, f5, 1e-6));
145 
146  TableFactor f5_with_wrong_keys(V & O, expected_values);
147  EXPECT(assert_inequal(f5_with_wrong_keys, f5, 1e-9));
148 }
149 
150 /* ************************************************************************* */
151 // Check conversion from DecisionTreeFactor.
152 TEST(TableFactor, Conversion) {
153  /* This is the DecisionTree we are using
154  Choice(m2)
155  0 Choice(m1)
156  0 0 Leaf 0
157  0 1 Choice(m0)
158  0 1 0 Leaf 0
159  0 1 1 Leaf 0.14649446 // 3
160  1 Choice(m1)
161  1 0 Choice(m0)
162  1 0 0 Leaf 0
163  1 0 1 Leaf 0.14648756 // 5
164  1 1 Choice(m0)
165  1 1 0 Leaf 0.14649446 // 6
166  1 1 1 Leaf 0.23918345 // 7
167  */
168  DiscreteKeys dkeys = {{0, 2}, {1, 2}, {2, 2}};
169  DecisionTreeFactor dtf(
170  dkeys, std::vector<double>{0, 0, 0, 0.14649446, 0, 0.14648756, 0.14649446,
171  0.23918345});
172 
173  TableFactor tf(dtf.discreteKeys(), dtf);
174 
175  EXPECT(assert_equal(dtf, tf.toDecisionTreeFactor()));
176 }
177 
178 /* ************************************************************************* */
179 // Check multiplication between two TableFactors.
180 TEST(TableFactor, multiplication) {
181  DiscreteKey v0(0, 2), v1(1, 2), v2(2, 2);
182 
183  // Multiply with a DiscreteDistribution, i.e., Bayes Law!
184  DiscreteDistribution prior(v1 % "1/3");
185  TableFactor f1(v0 & v1, "1 2 3 4");
186  DecisionTreeFactor expected(v0 & v1, "0.25 1.5 0.75 3");
188  f1.toDecisionTreeFactor()));
190 
191  // Multiply two factors
192  TableFactor f2(v1 & v2, "5 6 7 8");
193  TableFactor actual = f1 * f2;
194  TableFactor expected2(v0 & v1 & v2, "5 6 14 16 15 18 28 32");
195  CHECK(assert_equal(expected2, actual));
196 
197  DiscreteKey A(0, 3), B(1, 2), C(2, 2);
198  TableFactor f_zeros1(A & C, "0 0 0 2 0 3");
199  TableFactor f_zeros2(B & C, "4 0 0 5");
200  TableFactor actual_zeros = f_zeros1 * f_zeros2;
201  TableFactor expected3(A & B & C, "0 0 0 0 0 0 0 10 0 0 0 15");
202  CHECK(assert_equal(expected3, actual_zeros));
203 }
204 
205 /* ************************************************************************* */
206 // Benchmark which compares runtime of multiplication of two TableFactors
207 // and two DecisionTreeFactors given sparsity from dense to 90% sparsity.
208 // NOTE: Enable to run.
210  DiscreteKey A(0, 5), B(1, 2), C(2, 5), D(3, 2), E(4, 5), F(5, 2), G(6, 3),
211  H(7, 2), I(8, 5), J(9, 7), K(10, 2), L(11, 3);
212 
213  // 100
214  DiscreteKeys one_1 = {A, B, C, D};
215  DiscreteKeys one_2 = {C, D, E, F};
216  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_1 =
217  measureTime(one_1, one_2, 100);
218  printTime(time_map_1);
219  // 200
220  DiscreteKeys two_1 = {A, B, C, D, F};
221  DiscreteKeys two_2 = {B, C, D, E, F};
222  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_2 =
223  measureTime(two_1, two_2, 200);
224  printTime(time_map_2);
225  // 300
226  DiscreteKeys three_1 = {A, B, C, D, G};
227  DiscreteKeys three_2 = {C, D, E, F, G};
228  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_3 =
229  measureTime(three_1, three_2, 300);
230  printTime(time_map_3);
231  // 400
232  DiscreteKeys four_1 = {A, B, C, D, F, H};
233  DiscreteKeys four_2 = {B, C, D, E, F, H};
234  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_4 =
235  measureTime(four_1, four_2, 400);
236  printTime(time_map_4);
237  // 500
238  DiscreteKeys five_1 = {A, B, C, D, I};
239  DiscreteKeys five_2 = {C, D, E, F, I};
240  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_5 =
241  measureTime(five_1, five_2, 500);
242  printTime(time_map_5);
243  // 600
244  DiscreteKeys six_1 = {A, B, C, D, F, G};
245  DiscreteKeys six_2 = {B, C, D, E, F, G};
246  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_6 =
247  measureTime(six_1, six_2, 600);
248  printTime(time_map_6);
249  // 700
250  DiscreteKeys seven_1 = {A, B, C, D, J};
251  DiscreteKeys seven_2 = {C, D, E, F, J};
252  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_7 =
253  measureTime(seven_1, seven_2, 700);
254  printTime(time_map_7);
255  // 800
256  DiscreteKeys eight_1 = {A, B, C, D, F, H, K};
257  DiscreteKeys eight_2 = {B, C, D, E, F, H, K};
258  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_8 =
259  measureTime(eight_1, eight_2, 800);
260  printTime(time_map_8);
261  // 900
262  DiscreteKeys nine_1 = {A, B, C, D, G, L};
263  DiscreteKeys nine_2 = {C, D, E, F, G, L};
264  map<double, pair<chrono::microseconds, chrono::microseconds>> time_map_9 =
265  measureTime(nine_1, nine_2, 900);
266  printTime(time_map_9);
267 }
268 
269 /* ************************************************************************* */
270 // Check sum and max over frontals.
271 TEST(TableFactor, sum_max) {
272  DiscreteKey v0(0, 3), v1(1, 2);
273  TableFactor f1(v0 & v1, "1 2 3 4 5 6");
274 
275  TableFactor expected(v1, "9 12");
276  TableFactor::shared_ptr actual = f1.sum(1);
277  CHECK(assert_equal(expected, *actual, 1e-5));
278 
279  TableFactor expected2(v1, "5 6");
280  TableFactor::shared_ptr actual2 = f1.max(1);
281  CHECK(assert_equal(expected2, *actual2));
282 
283  TableFactor f2(v1 & v0, "1 2 3 4 5 6");
284  TableFactor::shared_ptr actual22 = f2.sum(1);
285 }
286 
287 /* ************************************************************************* */
288 // Check enumerate yields the correct list of assignment/value pairs.
289 TEST(TableFactor, enumerate) {
290  DiscreteKey A(12, 3), B(5, 2);
291  TableFactor f(A & B, "1 2 3 4 5 6");
292  auto actual = f.enumerate();
293  std::vector<std::pair<DiscreteValues, double>> expected;
295  for (size_t a : {0, 1, 2}) {
296  for (size_t b : {0, 1}) {
297  values[12] = a;
298  values[5] = b;
299  expected.emplace_back(values, f(values));
300  }
301  }
302  EXPECT(actual == expected);
303 }
304 
305 /* ************************************************************************* */
306 // Check pruning of the decision tree works as expected.
307 TEST(TableFactor, Prune) {
308  DiscreteKey A(1, 2), B(2, 2), C(3, 2);
309  TableFactor f(A & B & C, "1 5 3 7 2 6 4 8");
310 
311  // Only keep the leaves with the top 5 values.
312  size_t maxNrAssignments = 5;
313  auto pruned5 = f.prune(maxNrAssignments);
314 
315  // Pruned leaves should be 0
316  TableFactor expected(A & B & C, "0 5 0 7 0 6 4 8");
317  EXPECT(assert_equal(expected, pruned5));
318 
319  // Check for more extreme pruning where we only keep the top 2 leaves
320  maxNrAssignments = 2;
321  auto pruned2 = f.prune(maxNrAssignments);
322  TableFactor expected2(A & B & C, "0 0 0 7 0 0 0 8");
323  EXPECT(assert_equal(expected2, pruned2));
324 
325  DiscreteKey D(4, 2);
327  D & C & B & A,
328  "0.0 0.0 0.0 0.60658897 0.61241912 0.61241969 0.61247685 0.61247742 0.0 "
329  "0.0 0.0 0.99995287 1.0 1.0 1.0 1.0");
330 
331  TableFactor expected3(D & C & B & A,
332  "0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 "
333  "0.999952870000 1.0 1.0 1.0 1.0");
334  maxNrAssignments = 5;
335  auto pruned3 = factor.prune(maxNrAssignments);
336  EXPECT(assert_equal(expected3, pruned3));
337 }
338 
339 /* ************************************************************************* */
340 // Check markdown representation looks as expected.
342  DiscreteKey A(12, 3), B(5, 2);
343  TableFactor f(A & B, "1 2 3 4 5 6");
344  string expected =
345  "|A|B|value|\n"
346  "|:-:|:-:|:-:|\n"
347  "|0|0|1|\n"
348  "|0|1|2|\n"
349  "|1|0|3|\n"
350  "|1|1|4|\n"
351  "|2|0|5|\n"
352  "|2|1|6|\n";
353  auto formatter = [](Key key) { return key == 12 ? "A" : "B"; };
354  string actual = f.markdown(formatter);
355  EXPECT(actual == expected);
356 }
357 
358 /* ************************************************************************* */
359 // Check markdown representation with a value formatter.
360 TEST(TableFactor, markdownWithValueFormatter) {
361  DiscreteKey A(12, 3), B(5, 2);
362  TableFactor f(A & B, "1 2 3 4 5 6");
363  string expected =
364  "|A|B|value|\n"
365  "|:-:|:-:|:-:|\n"
366  "|Zero|-|1|\n"
367  "|Zero|+|2|\n"
368  "|One|-|3|\n"
369  "|One|+|4|\n"
370  "|Two|-|5|\n"
371  "|Two|+|6|\n";
372  auto keyFormatter = [](Key key) { return key == 12 ? "A" : "B"; };
373  TableFactor::Names names{{12, {"Zero", "One", "Two"}}, {5, {"-", "+"}}};
374  string actual = f.markdown(keyFormatter, names);
375  EXPECT(actual == expected);
376 }
377 
378 /* ************************************************************************* */
379 // Check html representation with a value formatter.
380 TEST(TableFactor, htmlWithValueFormatter) {
381  DiscreteKey A(12, 3), B(5, 2);
382  TableFactor f(A & B, "1 2 3 4 5 6");
383  string expected =
384  "<div>\n"
385  "<table class='TableFactor'>\n"
386  " <thead>\n"
387  " <tr><th>A</th><th>B</th><th>value</th></tr>\n"
388  " </thead>\n"
389  " <tbody>\n"
390  " <tr><th>Zero</th><th>-</th><td>1</td></tr>\n"
391  " <tr><th>Zero</th><th>+</th><td>2</td></tr>\n"
392  " <tr><th>One</th><th>-</th><td>3</td></tr>\n"
393  " <tr><th>One</th><th>+</th><td>4</td></tr>\n"
394  " <tr><th>Two</th><th>-</th><td>5</td></tr>\n"
395  " <tr><th>Two</th><th>+</th><td>6</td></tr>\n"
396  " </tbody>\n"
397  "</table>\n"
398  "</div>";
399  auto keyFormatter = [](Key key) { return key == 12 ? "A" : "B"; };
400  TableFactor::Names names{{12, {"Zero", "One", "Two"}}, {5, {"-", "+"}}};
401  string actual = f.html(keyFormatter, names);
402  EXPECT(actual == expected);
403 }
404 
405 /* ************************************************************************* */
406 TEST(TableFactor, Unary) {
407  // Declare a bunch of keys
408  DiscreteKey X(0, 2), Y(1, 3);
409 
410  // Create factors
411  TableFactor f(X & Y, "2 5 3 6 2 7");
412  auto op = [](const double x) { return 2 * x; };
413  auto g = f.apply(op);
414 
415  TableFactor expected(X & Y, "4 10 6 12 4 14");
417 
418  auto sq_op = [](const double x) { return x * x; };
419  auto g_sq = f.apply(sq_op);
420  TableFactor expected_sq(X & Y, "4 25 9 36 4 49");
421  EXPECT(assert_equal(g_sq, expected_sq));
422 }
423 
424 /* ************************************************************************* */
425 TEST(TableFactor, UnaryAssignment) {
426  // Declare a bunch of keys
427  DiscreteKey X(0, 2), Y(1, 3);
428 
429  // Create factors
430  TableFactor f(X & Y, "2 5 3 6 2 7");
431  auto op = [](const Assignment<Key>& key, const double x) { return 2 * x; };
432  auto g = f.apply(op);
433 
434  TableFactor expected(X & Y, "4 10 6 12 4 14");
436 }
437 
438 /* ************************************************************************* */
439 int main() {
440  TestResult tr;
441  return TestRegistry::runAllTests(tr);
442 }
443 /* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
TEST
TEST(TableFactor, constructors)
Definition: testTableFactor.cpp:103
TEST_DISABLED
TEST_DISABLED(TableFactor, benchmark)
Definition: testTableFactor.cpp:209
H
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
Definition: gnuplot_common_settings.hh:74
gtsam::TableFactor
Definition: TableFactor.h:47
gtsam::markdown
string markdown(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of markdown.
Definition: DiscreteValues.cpp:130
gtsam::DecisionTreeFactor
Definition: DecisionTreeFactor.h:45
B
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:49
measureTime
map< double, pair< chrono::microseconds, chrono::microseconds > > measureTime(DiscreteKeys keys1, DiscreteKeys keys2, size_t size)
Definition: testTableFactor.cpp:48
benchmark
Definition: benchmark.py:1
D
MatrixXcd D
Definition: EigenSolver_EigenSolver_MatrixType.cpp:14
test_constructor::f1
auto f1
Definition: testHybridNonlinearFactor.cpp:56
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
v0
static const double v0
Definition: testCal3DFisheye.cpp:31
EXPECT_LONGS_EQUAL
#define EXPECT_LONGS_EQUAL(expected, actual)
Definition: Test.h:154
Testable.h
Concept check for values that can be used in unit tests.
EXPECT
#define EXPECT(condition)
Definition: Test.h:150
TestHarness.h
genArr
vector< double > genArr(double dropout, size_t size)
Definition: testTableFactor.cpp:33
b
Scalar * b
Definition: benchVecAdd.cpp:17
gtsam::DiscreteDistribution
Definition: DiscreteDistribution.h:33
gtsam::Y
GaussianFactorGraphValuePair Y
Definition: HybridGaussianProductFactor.cpp:29
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
gtsam::DecisionTreeFactor::prune
DecisionTreeFactor prune(size_t maxNrAssignments) const
Prune the decision tree of discrete variables.
Definition: DecisionTreeFactor.cpp:464
formatter
const KeyFormatter & formatter
Definition: treeTraversal-inst.h:204
f2
double f2(const Vector2 &x)
Definition: testNumericalDerivative.cpp:58
different_sigmas::values
HybridValues values
Definition: testHybridBayesNet.cpp:245
log
const EIGEN_DEVICE_FUNC LogReturnType log() const
Definition: ArrayCwiseUnaryOps.h:128
X
#define X
Definition: icosphere.cpp:20
gtsam::DiscreteKeys
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition: DiscreteKey.h:41
DiscreteConditional.h
A
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:48
pruning_fixture::factor
DecisionTreeFactor factor(D &C &B &A, "0.0 0.0 0.0 0.60658897 0.61241912 0.61241969 0.61247685 0.61247742 0.0 " "0.0 0.0 0.99995287 1.0 1.0 1.0 1.0")
size
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
printTime
void printTime(map< double, pair< chrono::microseconds, chrono::microseconds >> measured_time)
Definition: testTableFactor.cpp:92
J
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
I
#define I
Definition: main.h:112
Signature.h
signatures for conditional densities
cholesky::expected
Matrix expected
Definition: testMatrix.cpp:971
L
MatrixXd L
Definition: LLT_example.cpp:6
gtsam::Assignment< Key >
TableFactor.h
gtsam::symbol_shorthand::F
Key F(std::uint64_t j)
Definition: inference/Symbol.h:153
EXPECT_DOUBLES_EQUAL
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
Definition: Test.h:161
g
void g(const string &key, int i)
Definition: testBTree.cpp:41
serializationTestHelpers.h
TestResult
Definition: TestResult.h:26
key
const gtsam::Symbol key('X', 0)
E
DiscreteKey E(5, 2)
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
process_shonan_timing_results.names
dictionary names
Definition: process_shonan_timing_results.py:175
gtsam::symbol_shorthand::O
Key O(std::uint64_t j)
Definition: inference/Symbol.h:162
gtsam::DiscreteConditional
Definition: DiscreteConditional.h:37
main
int main()
Definition: testTableFactor.cpp:439
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
gtsam
traits
Definition: SFMdata.h:40
K
#define K
Definition: igam.h:8
gtsam::DiscreteValues
Definition: DiscreteValues.h:34
f3
double f3(double x1, double x2)
Definition: testNumericalDerivative.cpp:78
DiscreteDistribution.h
gtsam::symbol_shorthand::W
Key W(std::uint64_t j)
Definition: inference/Symbol.h:170
CHECK
#define CHECK(condition)
Definition: Test.h:108
gtsam::DiscreteKey
std::pair< Key, size_t > DiscreteKey
Definition: DiscreteKey.h:38
std
Definition: BFloat16.h:88
G
JacobiRotation< float > G
Definition: Jacobi_makeGivens.cpp:2
v2
Vector v2
Definition: testSerializationBase.cpp:39
f4
double f4(double x, double y, double z)
Definition: testNumericalDerivative.cpp:107
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:41
gtsam::DecisionTreeFactor::enumerate
std::vector< std::pair< DiscreteValues, double > > enumerate() const
Enumerate all values into a map from values to double.
Definition: DecisionTreeFactor.cpp:187
V
MatrixXcd V
Definition: EigenSolver_EigenSolver_MatrixType.cpp:15
gtsam::assert_inequal
bool assert_inequal(const Matrix &A, const Matrix &B, double tol)
Definition: Matrix.cpp:61
different_sigmas::prior
const auto prior
Definition: testHybridBayesNet.cpp:238
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
Z
#define Z
Definition: icosphere.cpp:21
gtsam::TableFactor::shared_ptr
std::shared_ptr< TableFactor > shared_ptr
Definition: TableFactor.h:98
v1
Vector v1
Definition: testSerializationBase.cpp:38


gtsam
Author(s):
autogenerated on Wed Jan 1 2025 04:07:30