diff --git a/.cproject b/.cproject
index d3c85a7ec..da141d84a 100644
--- a/.cproject
+++ b/.cproject
@@ -311,6 +311,14 @@
true
true
+
+ make
+ -j2
+ testGaussianFactor.run
+ true
+ true
+ true
+
make
-j2
@@ -337,7 +345,6 @@
make
-
tests/testBayesTree.run
true
false
@@ -345,7 +352,6 @@
make
-
testBinaryBayesNet.run
true
false
@@ -393,7 +399,6 @@
make
-
testSymbolicBayesNet.run
true
false
@@ -401,7 +406,6 @@
make
-
tests/testSymbolicFactor.run
true
false
@@ -409,7 +413,6 @@
make
-
testSymbolicFactorGraph.run
true
false
@@ -425,20 +428,11 @@
make
-
tests/testBayesTree
true
false
true
-
- make
- -j2
- testGaussianFactor.run
- true
- true
- true
-
make
-j2
@@ -465,6 +459,7 @@
make
+
testGraph.run
true
false
@@ -536,6 +531,7 @@
make
+
testInference.run
true
false
@@ -543,6 +539,7 @@
make
+
testGaussianFactor.run
true
false
@@ -550,6 +547,7 @@
make
+
testJunctionTree.run
true
false
@@ -557,6 +555,7 @@
make
+
testSymbolicBayesNet.run
true
false
@@ -564,6 +563,7 @@
make
+
testSymbolicFactorGraph.run
true
false
@@ -633,22 +633,6 @@
false
true
-
- make
- -j2
- tests/testPose2.run
- true
- true
- true
-
-
- make
- -j2
- tests/testPose3.run
- true
- true
- true
-
make
-j2
@@ -665,6 +649,22 @@
true
true
+
+ make
+ -j2
+ tests/testPose2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ tests/testPose3.run
+ true
+ true
+ true
+
make
-j2
@@ -689,26 +689,18 @@
true
true
-
+
make
- -j2
- all
+ -j5
+ nonlinear.testValues.run
true
true
true
-
+
make
- -j2
- check
- true
- true
- true
-
-
- make
- -j2
- clean
+ -j5
+ nonlinear.testOrdering.run
true
true
true
@@ -745,18 +737,26 @@
true
true
-
+
make
- -j5
- nonlinear.testValues.run
+ -j2
+ all
true
true
true
-
+
make
- -j5
- nonlinear.testOrdering.run
+ -j2
+ check
+ true
+ true
+ true
+
+
+ make
+ -j2
+ clean
true
true
true
@@ -969,14 +969,6 @@
true
true
-
- make
- -j2
- SimpleRotation.run
- true
- true
- true
-
make
-j2
@@ -1067,7 +1059,6 @@
make
-
testErrors.run
true
false
@@ -1523,6 +1514,7 @@
make
+
testSimulated2DOriented.run
true
false
@@ -1562,6 +1554,7 @@
make
+
testSimulated2D.run
true
false
@@ -1569,6 +1562,7 @@
make
+
testSimulated3D.run
true
false
@@ -1750,6 +1744,14 @@
true
true
+
+ make
+ -j5
+ UGM_small.run
+ true
+ true
+ true
+
make
-j2
@@ -1760,6 +1762,7 @@
make
+
tests/testGaussianISAM2
true
false
@@ -1781,6 +1784,102 @@
true
true
+
+ make
+ -j2
+ testRot3.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testRot2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testPose3.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ timeRot3.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testPose2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testCal3_S2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testSimpleCamera.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testHomography2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testCalibratedCamera.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ check
+ true
+ true
+ true
+
+
+ make
+ -j2
+ clean
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testPoint2.run
+ true
+ true
+ true
+
make
-j2
@@ -1982,7 +2081,6 @@
cpack
-
-G DEB
true
false
@@ -1990,7 +2088,6 @@
cpack
-
-G RPM
true
false
@@ -1998,7 +2095,6 @@
cpack
-
-G TGZ
true
false
@@ -2006,7 +2102,6 @@
cpack
-
--config CPackSourceConfig.cmake
true
false
@@ -2020,98 +2115,42 @@
true
true
-
+
make
- -j2
- testRot3.run
+ -j5
+ wrap.testSpirit.run
true
true
true
-
+
make
- -j2
- testRot2.run
+ -j5
+ wrap.testWrap.run
true
true
true
-
+
make
- -j2
- testPose3.run
+ -j5
+ check.wrap
true
true
true
-
+
make
- -j2
- timeRot3.run
+ -j5
+ wrap_gtsam
true
true
true
-
+
make
- -j2
- testPose2.run
- true
- true
- true
-
-
- make
- -j2
- testCal3_S2.run
- true
- true
- true
-
-
- make
- -j2
- testSimpleCamera.run
- true
- true
- true
-
-
- make
- -j2
- testHomography2.run
- true
- true
- true
-
-
- make
- -j2
- testCalibratedCamera.run
- true
- true
- true
-
-
- make
- -j2
- check
- true
- true
- true
-
-
- make
- -j2
- clean
- true
- true
- true
-
-
- make
- -j2
- testPoint2.run
+ -j5
+ wrap
true
true
true
@@ -2155,46 +2194,6 @@
false
true
-
- make
- -j5
- wrap.testSpirit.run
- true
- true
- true
-
-
- make
- -j5
- wrap.testWrap.run
- true
- true
- true
-
-
- make
- -j5
- check.wrap
- true
- true
- true
-
-
- make
- -j5
- wrap_gtsam
- true
- true
- true
-
-
- make
- -j5
- wrap
- true
- true
- true
-
diff --git a/examples/README b/examples/README
index 87368b2ef..d7706a0b8 100644
--- a/examples/README
+++ b/examples/README
@@ -26,4 +26,10 @@ Visual SLAM
The directory vSLAMexample includes 2 simple examples using GTSAM:
- vSFMexample using visualSLAM in for structure-from-motion (SFM), and
- vISAMexample using visualSLAM and ISAM for incremental SLAM updates
-See the separate README file there.
\ No newline at end of file
+See the separate README file there.
+
+Undirected Graphical Models (UGM)
+=================================
+The best representation for a Markov Random Field is a factor graph :-)
+This is illustrated with some discrete examples from the UGM MATLAB toolbox, which
+can be found at http://www.di.ens.fr/~mschmidt/Software/UGM
\ No newline at end of file
diff --git a/examples/UGM_small.cpp b/examples/UGM_small.cpp
new file mode 100644
index 000000000..a4655d2ad
--- /dev/null
+++ b/examples/UGM_small.cpp
@@ -0,0 +1,74 @@
+/* ----------------------------------------------------------------------------
+
+ * GTSAM Copyright 2010, Georgia Tech Research Corporation,
+ * Atlanta, Georgia 30332-0415
+ * All Rights Reserved
+ * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
+
+ * See LICENSE for the license information
+
+ * -------------------------------------------------------------------------- */
+
+/**
+ * @file small.cpp
+ * @brief UGM (undirected graphical model) examples: small
+ * @author Frank Dellaert
+ *
+ * See http://www.di.ens.fr/~mschmidt/Software/UGM/small.html
+ */
+
+#include
+#include
+
+using namespace std;
+using namespace gtsam;
+
+int main(int argc, char** argv) {
+
+ // We will assume 2-state variables, where, to conform to the "small" example
+ // we have 0 == "right answer" and 1 == "wrong answer"
+ size_t nrStates = 2;
+
+ // define variables
+ DiscreteKey Cathy(1, nrStates), Heather(2, nrStates), Mark(3, nrStates),
+ Allison(4, nrStates);
+
+ // create graph
+ DiscreteFactorGraph graph;
+
+ // add node potentials
+ graph.add(Cathy, "1 3");
+ graph.add(Heather, "9 1");
+ graph.add(Mark, "1 3");
+ graph.add(Allison, "9 1");
+
+ // add edge potentials
+ graph.add(Cathy & Heather, "2 1 1 2");
+ graph.add(Heather & Mark, "2 1 1 2");
+ graph.add(Mark & Allison, "2 1 1 2");
+
+ // Print the UGM distribution
+ cout << "\nUGM distribution:" << endl;
+ for (size_t a = 0; a < nrStates; a++)
+ for (size_t m = 0; m < nrStates; m++)
+ for (size_t h = 0; h < nrStates; h++)
+ for (size_t c = 0; c < nrStates; c++) {
+ DiscreteFactor::Values values;
+ values[1] = c;
+ values[2] = h;
+ values[3] = m;
+ values[4] = a;
+ double prodPot = graph(values);
+ cout << c << " " << h << " " << m << " " << a << " :\t"
+ << prodPot << "\t" << prodPot/3790 << endl;
+ }
+
+ // "Decoding", i.e., configuration with largest value
+ // We use sequential variable elimination
+ DiscreteSequentialSolver solver(graph);
+ DiscreteFactor::sharedValues optimalDecoding = solver.optimize();
+ optimalDecoding->print("\noptimalDecoding");
+
+ return 0;
+}
+