Public Types | Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
gtsam::internal::ExecutionTrace< T > Class Template Reference

#include <Expression.h>

Public Types

typedef ExecutionTrace< Ttype
 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 >
boost::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, DimJacobianTT
 

Private Attributes

union {
   Key   key
 
   CallRecord< Dim > *   ptr
 
content
 
enum gtsam::internal::ExecutionTrace:: { ... }  kind
 

Static Private Attributes

static const int Dim = traits<T>::dimension
 

Detailed Description

template<class T>
class gtsam::internal::ExecutionTrace< T >

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 41 of file Expression.h.

Member Typedef Documentation

template<class T>
typedef Eigen::Matrix<double, Dim, Dim> gtsam::internal::ExecutionTrace< T >::JacobianTT
private

Definition at line 94 of file ExecutionTrace.h.

template<class T>
typedef ExecutionTrace<T> gtsam::internal::ExecutionTrace< T >::type

Define type so we can apply it as a meta-function.

Definition at line 179 of file ExecutionTrace.h.

Member Enumeration Documentation

template<class T>
anonymous enum
private
Enumerator
Constant 
Leaf 
Function 

Definition at line 95 of file ExecutionTrace.h.

Constructor & Destructor Documentation

template<class T>
gtsam::internal::ExecutionTrace< T >::ExecutionTrace ( )
inline

Pointer always starts out as a Constant.

Definition at line 106 of file ExecutionTrace.h.

template<class T>
gtsam::internal::ExecutionTrace< T >::~ExecutionTrace ( )
inline

Definition at line 172 of file ExecutionTrace.h.

Member Function Documentation

template<class T>
void gtsam::internal::ExecutionTrace< T >::print ( const std::string &  indent = "") const
inline

Print.

Definition at line 123 of file ExecutionTrace.h.

template<class T>
template<class Record >
boost::optional<Record*> gtsam::internal::ExecutionTrace< T >::record ( )
inline

Return record pointer, quite unsafe, used only for testing.

Definition at line 135 of file ExecutionTrace.h.

template<class T>
template<typename DerivedMatrix >
void gtsam::internal::ExecutionTrace< T >::reverseAD1 ( const Eigen::MatrixBase< DerivedMatrix > &  dTdA,
JacobianMap jacobians 
) const
inline

Either add to Jacobians (Leaf) or propagate (Function)

Definition at line 164 of file ExecutionTrace.h.

template<class T>
void gtsam::internal::ExecutionTrace< T >::setFunction ( CallRecord< Dim > *  record)
inline

Take ownership of pointer to a Function Record.

Definition at line 117 of file ExecutionTrace.h.

template<class T>
void gtsam::internal::ExecutionTrace< T >::setLeaf ( Key  key)
inline

Change pointer to a Leaf Record.

Definition at line 111 of file ExecutionTrace.h.

template<class T>
void gtsam::internal::ExecutionTrace< T >::startReverseAD1 ( JacobianMap jacobians) const
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 148 of file ExecutionTrace.h.

Member Data Documentation

union { ... } gtsam::internal::ExecutionTrace< T >::content
template<class T>
const int gtsam::internal::ExecutionTrace< T >::Dim = traits<T>::dimension
staticprivate

Definition at line 93 of file ExecutionTrace.h.

template<class T>
Key gtsam::internal::ExecutionTrace< T >::key

Definition at line 99 of file ExecutionTrace.h.

enum { ... } gtsam::internal::ExecutionTrace< T >::kind
template<class T>
CallRecord<Dim>* gtsam::internal::ExecutionTrace< T >::ptr

Definition at line 100 of file ExecutionTrace.h.


The documentation for this class was generated from the following files:


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:58:37