CoDiPack  2.3.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::MappedAdjoints< T_Identifier, T_Gradient > Struct Template Reference

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

Gradientoperator[] (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, Gradientadjoints
 

Detailed Description

template<typename T_Identifier, typename T_Gradient>
struct codi::MappedAdjoints< T_Identifier, T_Gradient >

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.

Template Parameters
T_IdentifierIdentifier type, usually chosen as Tape::Identifier.
T_GradientGradient type, corresponds to the Adjoint template parameter in the referred-to functions.

Member Data Documentation

◆ adjoints

template<typename T_Identifier , typename T_Gradient >
std::map<Identifier, Gradient> codi::MappedAdjoints< T_Identifier, T_Gradient >::adjoints
mutable

Internal map implementation, kept public for flexibility. Mutable so that access in constant call contexts does not prevent the insertion of new elements.


The documentation for this struct was generated from the following file: