diff --git a/.cproject b/.cproject
index 412359938..52c627f5c 100644
--- a/.cproject
+++ b/.cproject
@@ -600,6 +600,7 @@
make
+
tests/testBayesTree.run
true
false
@@ -607,6 +608,7 @@
make
+
testBinaryBayesNet.run
true
false
@@ -654,6 +656,7 @@
make
+
testSymbolicBayesNet.run
true
false
@@ -661,6 +664,7 @@
make
+
tests/testSymbolicFactor.run
true
false
@@ -668,6 +672,7 @@
make
+
testSymbolicFactorGraph.run
true
false
@@ -683,6 +688,7 @@
make
+
tests/testBayesTree
true
false
@@ -1114,6 +1120,7 @@
make
+
testErrors.run
true
false
@@ -1343,6 +1350,46 @@
true
true
+
+ make
+ -j5
+ testBTree.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testDSF.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testDSFMap.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testDSFVector.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testFixedVector.run
+ true
+ true
+ true
+
make
-j2
@@ -1425,7 +1472,6 @@
make
-
testSimulated2DOriented.run
true
false
@@ -1465,7 +1511,6 @@
make
-
testSimulated2D.run
true
false
@@ -1473,7 +1518,6 @@
make
-
testSimulated3D.run
true
false
@@ -1487,46 +1531,6 @@
true
true
-
- make
- -j5
- testBTree.run
- true
- true
- true
-
-
- make
- -j5
- testDSF.run
- true
- true
- true
-
-
- make
- -j5
- testDSFMap.run
- true
- true
- true
-
-
- make
- -j5
- testDSFVector.run
- true
- true
- true
-
-
- make
- -j5
- testFixedVector.run
- true
- true
- true
-
make
-j5
@@ -1784,6 +1788,7 @@
cpack
+
-G DEB
true
false
@@ -1791,6 +1796,7 @@
cpack
+
-G RPM
true
false
@@ -1798,6 +1804,7 @@
cpack
+
-G TGZ
true
false
@@ -1805,6 +1812,7 @@
cpack
+
--config CPackSourceConfig.cmake
true
false
@@ -2619,6 +2627,7 @@
make
+
testGraph.run
true
false
@@ -2626,6 +2635,7 @@
make
+
testJunctionTree.run
true
false
@@ -2633,6 +2643,7 @@
make
+
testSymbolicBayesNetB.run
true
false
@@ -2742,6 +2753,14 @@
true
true
+
+ make
+ -j5
+ testCallRecord.run
+ true
+ true
+ true
+
make
-j2
@@ -3152,7 +3171,6 @@
make
-
tests/testGaussianISAM2
true
false
diff --git a/gtsam_unstable/nonlinear/CallRecord.h b/gtsam_unstable/nonlinear/CallRecord.h
new file mode 100644
index 000000000..2161d9cb8
--- /dev/null
+++ b/gtsam_unstable/nonlinear/CallRecord.h
@@ -0,0 +1,181 @@
+/* ----------------------------------------------------------------------------
+
+ * 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 CallRecord.h
+ * @date November 21, 2014
+ * @author Frank Dellaert
+ * @author Paul Furgale
+ * @author Hannes Sommer
+ * @brief Internals for Expression.h, not for general consumption
+ */
+
+#pragma once
+
+#include
+#include
+#include
+
+namespace gtsam {
+
+class JacobianMap;
+// forward declaration
+
+//-----------------------------------------------------------------------------
+/**
+ * MaxVirtualStaticRows defines how many separate virtual reverseAD with specific
+ * static rows (1..MaxVirtualStaticRows) methods will be part of the CallRecord interface.
+ */
+const int MaxVirtualStaticRows = 4;
+
+namespace internal {
+
+/**
+ * ConvertToDynamicIf converts to a dense matrix with dynamic rows iff
+ * ConvertToDynamicRows (colums stay as they are) otherwise
+ * it just passes dense Eigen matrices through.
+ */
+template
+struct ConvertToDynamicRowsIf {
+ template
+ static Eigen::Matrix convert(
+ const Eigen::MatrixBase & x) {
+ return x;
+ }
+};
+
+template<>
+struct ConvertToDynamicRowsIf {
+ template
+ static const Eigen::Matrix & convert(
+ const Eigen::Matrix & x) {
+ return x;
+ }
+};
+
+/**
+ * Recursive definition of an interface having several purely
+ * virtual _reverseAD(const Eigen::Matrix &, JacobianMap&)
+ * with Rows in 1..MaxSupportedStaticRows
+ */
+template
+struct ReverseADInterface: public ReverseADInterface {
+protected:
+ using ReverseADInterface::_reverseAD;
+ virtual void _reverseAD(
+ const Eigen::Matrix & dFdT,
+ JacobianMap& jacobians) const = 0;
+};
+
+template
+struct ReverseADInterface<0, Cols> {
+protected:
+ void _reverseAD() {
+ } //dummy to allow the using directive in the template without failing for MaxSupportedStaticRows == 1.
+};
+}
+
+/**
+ * The CallRecord class stores the Jacobians of applying a function
+ * with respect to each of its arguments. It also stores an executation trace
+ * (defined below) for each of its arguments.
+ *
+ * It is implemented in the function-style ExpressionNode's nested Record class below.
+ */
+template
+struct CallRecord: private internal::ReverseADInterface {
+
+ inline void print(const std::string& indent) const {
+ _print(indent);
+ }
+
+ inline void startReverseAD(JacobianMap& jacobians) const {
+ _startReverseAD(jacobians);
+ }
+
+ template
+ inline void reverseAD(const Eigen::Matrix & dFdT,
+ JacobianMap& jacobians) const {
+ _reverseAD(
+ internal::ConvertToDynamicRowsIf<(Rows > MaxVirtualStaticRows)>::convert(
+ dFdT), jacobians);
+ }
+
+ virtual ~CallRecord() {
+ }
+
+private:
+
+ using internal::ReverseADInterface::_reverseAD;
+ virtual void _print(const std::string& indent) const = 0;
+ virtual void _startReverseAD(JacobianMap& jacobians) const = 0;
+ virtual void _reverseAD(
+ const Eigen::Matrix & dFdT,
+ JacobianMap& jacobians) const = 0;
+ virtual void _reverseAD(const Matrix & dFdT,
+ JacobianMap& jacobians) const = 0;
+};
+
+namespace internal {
+
+/**
+ * ReverseADImplementor is a utility class used by CallRecordImplementor to
+ * implementing the recursive CallRecord interface.
+ */
+template
+struct ReverseADImplementor: ReverseADImplementor {
+
+protected:
+
+ virtual void _reverseAD(
+ const Eigen::Matrix & dFdT,
+ JacobianMap& jacobians) const {
+ static_cast(this)->reverseAD(dFdT, jacobians);
+ }
+};
+
+template
+struct ReverseADImplementor : CallRecord {
+};
+
+/**
+ * The CallRecordImplementor implements the CallRecord interface for a Derived class by
+ * delegating to its corresponding (templated) non-virtual methods.
+ */
+template
+struct CallRecordImplementor: public ReverseADImplementor {
+private:
+ const Derived & derived() const {
+ return static_cast(*this);
+ }
+ virtual void _print(const std::string& indent) const {
+ derived().print(indent);
+ }
+ virtual void _startReverseAD(JacobianMap& jacobians) const {
+ derived().startReverseAD(jacobians);
+ }
+ virtual void _reverseAD(
+ const Eigen::Matrix & dFdT,
+ JacobianMap& jacobians) const {
+ derived().reverseAD(dFdT, jacobians);
+ }
+ virtual void _reverseAD(const Matrix & dFdT, JacobianMap& jacobians) const {
+ derived().reverseAD(dFdT, jacobians);
+ }
+};
+
+} // internal
+
+} // gtsam
diff --git a/gtsam_unstable/nonlinear/tests/testCallRecord.cpp b/gtsam_unstable/nonlinear/tests/testCallRecord.cpp
new file mode 100644
index 000000000..a8abf295a
--- /dev/null
+++ b/gtsam_unstable/nonlinear/tests/testCallRecord.cpp
@@ -0,0 +1,55 @@
+/* ----------------------------------------------------------------------------
+
+ * 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
+
+ * -------------------------------1------------------------------------------- */
+
+/**
+ * @file testCallRecord.cpp
+ * @date November 21, 2014
+ * @author Frank Dellaert
+ * @author Paul Furgale
+ * @author Hannes Sommer
+ * @brief unit tests for Callrecord class
+ */
+
+#include
+
+#include
+
+using namespace std;
+using namespace gtsam;
+
+/* ************************************************************************* */
+static const int Cols = 3;
+
+struct Record: public internal::CallRecordImplementor {
+ virtual ~Record() {
+ }
+ void print(const std::string& indent) const {
+ }
+ void startReverseAD(JacobianMap& jacobians) const {
+ }
+ template
+ void reverseAD(const SomeMatrix & dFdT, JacobianMap& jacobians) const {
+ }
+};
+
+/* ************************************************************************* */
+// Construct
+TEST(CallRecord, constant) {
+ Record record;
+}
+
+/* ************************************************************************* */
+int main() {
+ TestResult tr;
+ return TestRegistry::runAllTests(tr);
+}
+/* ************************************************************************* */
+