template <typename T, typename Derived>
Represents a mathematical expression in a type. Active data types, such as
FReal, as well as all mathematical expressions inherit from this class. Therefore all mathematical operations are defined on this type, rather than any specific derived class.
The derived classes are typically created transparently to the user.
Note that this class uses the CRTP pattern, where
Derivedis the derived class itself, so that static polymorphism can be used.
All global arithmetic operations defined in C++ are specialized
float can be replaced seamlessly with a XAD data type.
This also includes comparisons.
XAD also defines expression traits to find out information about expressions in a templated context. This is typically only needed when custom functions dealing with the XAD expressions are added.
- enum Direction¶
Enum to indicate the direction of algorithmic differentiation associated with a type.
- enumerator DIR_NONE¶
Not an algorithmic differentiation type
- enumerator DIR_FORWARD¶
Forward mode AD type
- enumerator DIR_REVERSE¶
Reverse mode AD type
template <typename T>
Main traits class to find out information about an expression type.
- static const bool isExpr¶
True if the type is in fact an expression (or any XAD active variable)
- static const int numVariables¶
Number of variables that are port of the expression
- static const bool isForward¶
Boolean to represent if forward-mode AD
- static const bool isReverse¶
Boolean to represent if adjoint mode AD
- type nested_type¶
- type value_type¶
The underlying active type of the expression, e.g.
AReal<double>for a complex expression involving reverse mode active variables.