#include <Expression.h>
Public Types | |
typedef ExecutionTrace< T > | type |
Define type so we can apply it as a meta-function. More... | |
Public Member Functions | |
ExecutionTrace () | |
Pointer always starts out as a Constant. More... | |
void | print (const std::string &indent="") const |
Print. More... | |
template<class Record > | |
std::optional< Record * > | record () |
Return record pointer, quite unsafe, used only for testing. More... | |
template<typename DerivedMatrix > | |
void | reverseAD1 (const Eigen::MatrixBase< DerivedMatrix > &dTdA, JacobianMap &jacobians) const |
Either add to Jacobians (Leaf) or propagate (Function) More... | |
void | setFunction (CallRecord< Dim > *record) |
Take ownership of pointer to a Function Record. More... | |
void | setLeaf (Key key) |
Change pointer to a Leaf Record. More... | |
void | startReverseAD1 (JacobianMap &jacobians) const |
~ExecutionTrace () | |
Private Types | |
enum | { Constant, Leaf, Function } |
typedef Eigen::Matrix< double, Dim, Dim > | JacobianTT |
Private Attributes | |
union { | |
Key key | |
CallRecord< Dim > * ptr | |
} | content |
enum gtsam::internal::ExecutionTrace:: { ... } | kind |
Static Private Attributes | |
static const int | Dim = traits<T>::dimension |
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
Definition at line 39 of file Expression.h.
|
private |
Definition at line 103 of file ExecutionTrace.h.
typedef ExecutionTrace<T> gtsam::internal::ExecutionTrace< T >::type |
Define type so we can apply it as a meta-function.
Definition at line 189 of file ExecutionTrace.h.
|
private |
Enumerator | |
---|---|
Constant | |
Leaf | |
Function |
Definition at line 104 of file ExecutionTrace.h.
|
inline |
Pointer always starts out as a Constant.
Definition at line 115 of file ExecutionTrace.h.
|
inline |
Definition at line 182 of file ExecutionTrace.h.
|
inline |
Print.
Definition at line 132 of file ExecutionTrace.h.
|
inline |
Return record pointer, quite unsafe, used only for testing.
Definition at line 144 of file ExecutionTrace.h.
|
inline |
Either add to Jacobians (Leaf) or propagate (Function)
Definition at line 174 of file ExecutionTrace.h.
|
inline |
Take ownership of pointer to a Function Record.
Definition at line 126 of file ExecutionTrace.h.
|
inline |
Change pointer to a Leaf Record.
Definition at line 120 of file ExecutionTrace.h.
|
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)
Definition at line 157 of file ExecutionTrace.h.
union { ... } gtsam::internal::ExecutionTrace< T >::content |
|
staticprivate |
Definition at line 102 of file ExecutionTrace.h.
Key gtsam::internal::ExecutionTrace< T >::key |
Definition at line 108 of file ExecutionTrace.h.
enum { ... } gtsam::internal::ExecutionTrace< T >::kind |
CallRecord<Dim>* gtsam::internal::ExecutionTrace< T >::ptr |
Definition at line 109 of file ExecutionTrace.h.