Unified access to the adjoint vector and primal vector in a tape evaluation. More...
#include <vectorAccessInterface.hpp>
Public Types | |
using | Identifier = T_Identifier |
See VectorAccessInterface. | |
using | Real = T_Real |
See VectorAccessInterface. | |
Public Member Functions | |
virtual | ~VectorAccessInterface () |
Destructor. | |
Misc | |
virtual size_t | getVectorSize () const =0 |
Vector size in the current tape evaluation. | |
virtual bool | isLhsZero ()=0 |
True if the adjoint set with setLhsAdjoint is zero. | |
virtual VectorAccessInterface * | clone () const =0 |
Indirect adjoint access | |
virtual void | setLhsAdjoint (Identifier const &index)=0 |
virtual void | updateAdjointWithLhs (Identifier const &index, Real const &jacobian)=0 |
Indirect tangent access | |
virtual void | setLhsTangent (Identifier const &index)=0 |
virtual void | updateTangentWithLhs (Identifier const &index, Real const &jacobian)=0 |
Direct adjoint access | |
virtual void | resetAdjoint (Identifier const &index, size_t dim)=0 |
Set the adjoint component to zero. | |
virtual void | resetAdjointVec (Identifier const &index)=0 |
Set the adjoint entry to zero. | |
virtual Real | getAdjoint (Identifier const &index, size_t dim)=0 |
Get the adjoint component. | |
virtual void | getAdjointVec (Identifier const &index, Real *const vec)=0 |
Get the adjoint entry. | |
virtual Real const * | getAdjointVec (Identifier const &index)=0 |
Get the adjoint entry. | |
virtual void | updateAdjoint (Identifier const &index, size_t dim, Real const &adjoint)=0 |
Update the adjoint component. | |
virtual void | updateAdjointVec (Identifier const &index, Real const *const vec)=0 |
Update the adjoint entry. | |
Primal access | |
virtual void | setPrimal (Identifier const &index, Real const &primal)=0 |
Set the primal value. | |
virtual Real | getPrimal (Identifier const &index)=0 |
Get the primal value. | |
virtual bool | hasPrimals ()=0 |
True if the tape/vector interface has primal values. | |
Unified access to the adjoint vector and primal vector in a tape evaluation.
The interface abstracts the vector access such that custom vectors modes ( Example 11 - External function user data) can be handled in a generalized way for external functions. All definitions in this interface are based on the primal evaluation type of the tape. This means that also all vector definitions need to be evaluated with this type.
In general, this interface allows to evaluate the forward and reverse AD equations. All mathematical symbols in this documentation refer to the linked equations.
All identifiers in this interface are tape identifiers and can be obtained with codi::ActiveType::getIdentifier.
The interface provides different access types for the user which can be separated into five categories (all functions listed in their typical order of use):
T_Real | The computation type of a tape, usually chosen as ActiveType::Real. |
T_Identifier | The adjoint/tangent identification of a tape, usually chosen as ActiveType::Identifier. |
|
pure virtual |
Obtain a heap-allocated copy of the vector access inter- face. The user is responsible for deleting the pointer.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, codi::AdjointVectorAccess< Real, Identifier, Gradient >, and codi::PrimalAdjointVectorAccess< T_Real, T_Identifier, T_Gradient >.
|
pure virtual |
Get the adjoint component.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >.
|
pure virtual |
Get the adjoint entry.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, and codi::AggregatedTypeVectorAccessWrapperBase< T_Real, T_Identifier, T_InnerInterface >.
|
pure virtual |
Get the adjoint entry.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, and codi::AggregatedTypeVectorAccessWrapperBase< T_Real, T_Identifier, T_InnerInterface >.
|
pure virtual |
Get the primal value.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, and codi::PrimalAdjointVectorAccess< T_Real, T_Identifier, T_Gradient >.
|
pure virtual |
Vector size in the current tape evaluation.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, codi::AdjointVectorAccess< Real, Identifier, Gradient >, and codi::AggregatedTypeVectorAccessWrapperBase< T_Real, T_Identifier, T_InnerInterface >.
|
pure virtual |
True if the tape/vector interface has primal values.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, codi::AdjointVectorAccess< Real, Identifier, Gradient >, codi::PrimalAdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, and codi::AggregatedTypeVectorAccessWrapperBase< T_Real, T_Identifier, T_InnerInterface >.
|
pure virtual |
True if the adjoint set with setLhsAdjoint is zero.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, codi::AdjointVectorAccess< Real, Identifier, Gradient >, and codi::AggregatedTypeVectorAccessWrapperBase< T_Real, T_Identifier, T_InnerInterface >.
|
pure virtual |
Set the adjoint component to zero.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >.
|
pure virtual |
Set the adjoint entry to zero.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >.
|
pure virtual |
Identify the lhs variable . Create an internal copy of and set to zero.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, and codi::AggregatedTypeVectorAccessWrapperBase< T_Real, T_Identifier, T_InnerInterface >.
|
pure virtual |
Perform . Internal memory is reset afterwards.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, and codi::AggregatedTypeVectorAccessWrapperBase< T_Real, T_Identifier, T_InnerInterface >.
|
pure virtual |
Set the primal value.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, and codi::PrimalAdjointVectorAccess< T_Real, T_Identifier, T_Gradient >.
|
pure virtual |
Update the adjoint component.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >.
|
pure virtual |
Update the adjoint entry.
Implemented in codi::AdjointVectorAccess< T_Real, T_Identifier, T_Gradient >, and codi::AggregatedTypeVectorAccessWrapperBase< T_Real, T_Identifier, T_InnerInterface >.
|
pure virtual |
|
pure virtual |