Implementation of adjoints via a map. More...
#include <customAdjoints.hpp>
Public Types | |
| using | Gradient = T_Gradient |
| See MappedAdjoints. | |
| using | Identifier = T_Identifier |
| See MappedAdjoints. | |
Public Member Functions | |
| Gradient & | operator[] (Identifier const &i) |
| Access operator in non-constant call contexts. | |
| Gradient const & | operator[] (Identifier const &i) const |
| Access operator in constant call contexts. | |
Public Attributes | |
| std::map< Identifier, Gradient > | adjoints |
Implementation of adjoints via a map.
Useful for the evaluation of tape parts with non-contiguous, far-apart identifiers. 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 implementation ensures that any identifier can be used to access the map, both in constant and non-constant calling contexts. Entries that do not exist yet are created on the fly and default-initialized.
| T_Identifier | Identifier type, usually chosen as Tape::Identifier. |
| T_Gradient | Gradient type, usually chosen as Tape::Gradient. |
|
mutable |
Internal map implementation, kept public for flexibility. Mutable so that access in constant call contexts does not prevent the insertion of new elements.