Allow for a direct access to the gradient information computed by the tape. More...
#include <gradientAccessTapeInterface.hpp>
Public Types | |
using | Gradient = T_Gradient |
See GradientAccessTapeInterface. | |
using | Identifier = T_Identifier |
See GradientAccessTapeInterface. | |
Public Member Functions | |
Interface definition | |
void | setGradient (Identifier const &identifier, Gradient const &gradient, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) |
Set the gradient. | |
Gradient const & | getGradient (Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const |
Set the gradient. | |
Gradient & | gradient (Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) |
Reference access to gradient. | |
Gradient const & | gradient (Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const |
Constant reference access to gradient. | |
Allow for a direct access to the gradient information computed by the tape.
See Tape Interface Design for a general overview of the tape interface design in CoDiPack.
The gradient information is usually accessed via the helper functions of the ActiveType, for example
These helper function are shortcuts to the functions provided in this interface, but the functions here can also be used to obtain the sensitivity information of a variable that is no longer present, for example (documentation/examples/gradientAccessTapeInterface.cpp):
T_Gradient | The gradient type of a tape, usually chosen as ActiveType::Gradient. |
T_Identifier | The adjoint/tangent identification of a tape, usually chosen as ActiveType::Identifier. |
Gradient const & codi::GradientAccessTapeInterface< T_Gradient, T_Identifier >::getGradient | ( | Identifier const & | identifier, |
AdjointsManagement | adjointsManagement = AdjointsManagement::Automatic ) const |
Set the gradient.
Automatic adjoints management involves bounds checking and locking. If no adjoint variable with the given identifier exists, a reference to adjoints[0] is returned. See AdjointsManagement for details.
Gradient & codi::GradientAccessTapeInterface< T_Gradient, T_Identifier >::gradient | ( | Identifier const & | identifier, |
AdjointsManagement | adjointsManagement = AdjointsManagement::Automatic ) |
Reference access to gradient.
Automatic adjoints management involves bounds checking, resizing, and locking, see AdjointsManagement for details.
Gradient const & codi::GradientAccessTapeInterface< T_Gradient, T_Identifier >::gradient | ( | Identifier const & | identifier, |
AdjointsManagement | adjointsManagement = AdjointsManagement::Automatic ) const |
Constant reference access to gradient.
Automatic adjoints management involves bounds checking and locking. If no adjoint variable with the given identifier exists, a reference to adjoints[0] is returned. See AdjointsManagement for details.
void codi::GradientAccessTapeInterface< T_Gradient, T_Identifier >::setGradient | ( | Identifier const & | identifier, |
Gradient const & | gradient, | ||
AdjointsManagement | adjointsManagement = AdjointsManagement::Automatic ) |
Set the gradient.
Automatic adjoints management involves bounds checking, resizing, and locking, see AdjointsManagement for details.