Implementation of vector-based adjoints that take into account an offset when addressing into the vector. More...
#include <customAdjoints.hpp>
Public Types | |
using | Gradient = T_Gradient |
See AdjointVectorWithOffset. | |
using | Identifier = T_Identifier |
See AdjointVectorWithOffset. | |
Public Member Functions | |
AdjointVectorWithOffset (Gradient *adjoints, Identifier const &offset) | |
Constructor. | |
inlineGradient & | operator[] (Identifier const &identifier) |
Access operator in non-constant call contexts. | |
inlineGradient const & | operator[] (Identifier const &identifier) const |
Access operator in constant call contexts. | |
Public Attributes | |
Gradient * | adjoints |
Points to user-provided adjoints memory. | |
Identifier const | offset |
Offset that is subtracted when addressing into the adjoints memory. | |
Implementation of vector-based adjoints that take into account an offset when addressing into the vector.
Useful if resizing adjoint vectors based on non-local information would result in a large overallocation. Can be used as custom adjoints for tape evaluations, see CustomAdjointVectorEvaluationTapeInterface. Can also be used for Jacobian computations with custom adjoints, see Algorithms::computeJacobianCustomAdjoints().
The user is responsible for providing memory with adequate size, no bounds checking is performed.
T_Identifier | Identifier type, usually chosen as Tape::Identifier. |
T_Gradient | Gradient type, usually chosen as Tape::Gradient. |