|
GTSAM
4.0.2
C++ library for smoothing and mapping (SAM)
|
#include <ExecutionTrace.h>

Public Types | |
| typedef ExecutionTrace< T > | type |
| Define type so we can apply it as a meta-function. | |
Public Member Functions | |
| ExecutionTrace () | |
| Pointer always starts out as a Constant. | |
| void | setLeaf (Key key) |
| Change pointer to a Leaf Record. | |
| void | setFunction (CallRecord< Dim > *record) |
| Take ownership of pointer to a Function Record. | |
| void | print (const std::string &indent="") const |
| Print. | |
| template<class Record > | |
| std::optional< Record * > | record () |
| Return record pointer, quite unsafe, used only for testing. | |
| void | startReverseAD1 (JacobianMap &jacobians) const |
| template<typename DerivedMatrix > | |
| void | reverseAD1 (const Eigen::MatrixBase< DerivedMatrix > &dTdA, JacobianMap &jacobians) const |
| Either add to Jacobians (Leaf) or propagate (Function) | |
The ExecutionTrace class records a tree-structured expression's execution.
The class looks a bit complicated but it is so for performance. It is a tagged union that obviates the need to create a ExecutionTrace subclass for Constants and Leaf Expressions. Instead the key for the leaf is stored in the space normally used to store a CallRecord*. Nothing is stored for a Constant.
A full execution trace of a Binary(Unary(Binary(Leaf,Constant)),Leaf) would be: Trace(Function) -> BinaryRecord with two traces in it trace1(Function) -> UnaryRecord with one trace in it trace1(Function) -> BinaryRecord with two traces in it trace1(Leaf) trace2(Constant) trace2(Leaf) Hence, there are three Record structs, written to memory by traceExecution
|
inline |
*** This is the main entry point for reverse AD, called from Expression *** Called only once, either inserts I into Jacobians (Leaf) or starts AD (Function)
1.8.13