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

Member Typedef Documentation

◆ JacobianTT

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

Definition at line 103 of file ExecutionTrace.h.

◆ type

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 189 of file ExecutionTrace.h.

Member Enumeration Documentation

◆ anonymous enum

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

Definition at line 104 of file ExecutionTrace.h.

Constructor & Destructor Documentation

◆ ExecutionTrace()

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

Pointer always starts out as a Constant.

Definition at line 115 of file ExecutionTrace.h.

◆ ~ExecutionTrace()

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

Definition at line 182 of file ExecutionTrace.h.

Member Function Documentation

◆ print()

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

Print.

Definition at line 132 of file ExecutionTrace.h.

◆ record()

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

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

Definition at line 144 of file ExecutionTrace.h.

◆ reverseAD1()

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 174 of file ExecutionTrace.h.

◆ setFunction()

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

Take ownership of pointer to a Function Record.

Definition at line 126 of file ExecutionTrace.h.

◆ setLeaf()

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

Change pointer to a Leaf Record.

Definition at line 120 of file ExecutionTrace.h.

◆ startReverseAD1()

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 157 of file ExecutionTrace.h.

Member Data Documentation

◆ content

union { ... } gtsam::internal::ExecutionTrace< T >::content

◆ Dim

template<class T >
const int gtsam::internal::ExecutionTrace< T >::Dim = traits<T>::dimension
staticprivate

Definition at line 102 of file ExecutionTrace.h.

◆ key

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

Definition at line 108 of file ExecutionTrace.h.

◆ kind

enum { ... } gtsam::internal::ExecutionTrace< T >::kind

◆ ptr

template<class T >
CallRecord<Dim>* gtsam::internal::ExecutionTrace< T >::ptr

Definition at line 109 of file ExecutionTrace.h.


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


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:16:35