CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::PreaccumulationEvaluationTapeInterface< T_Real, T_Gradient, T_Identifier, T_Position > Struct Template Reference

Perform tape evaluations but ensure that the state prior to evaluation equals the state after evaluation. More...

#include <preaccumulationEvaluationTapeInterface.hpp>

Inheritance diagram for codi::PreaccumulationEvaluationTapeInterface< T_Real, T_Gradient, T_Identifier, T_Position >:

Public Types

using Gradient = T_Gradient
 See PreaccumulationEvaluationTapeInterface.
 
using Identifier = T_Identifier
 See PreaccumulationEvaluationTapeInterface.
 
using Position = T_Position
 See PreaccumulationEvaluationTapeInterface.
 
using Real = T_Real
 See PreaccumulationEvaluationTapeInterface.
 
- Public Types inherited from codi::PositionalEvaluationTapeInterface< T_Position >
using Position = T_Position
 See PositionalEvaluationTapeInterface.
 
- Public Types inherited from codi::ForwardEvaluationTapeInterface< T_Position >
using Position = T_Position
 See ForwardEvaluationTapeInterface.
 
- Public Types inherited from codi::ManualStatementPushTapeInterface< T_Real, T_Gradient, T_Identifier >
using Gradient = T_Gradient
 See ManualStatementPushTapeInterface.
 
using Identifier = T_Identifier
 See ManualStatementPushTapeInterface.
 
using Real = T_Real
 See ManualStatementPushTapeInterface.
 

Public Member Functions

Interface definition
void evaluateKeepState (Position const &start, Position const &end, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a tape evaluation but restore the state afterwards such that it is the same as when the evaluation started. It hast to hold start >= end.
 
void evaluateForwardKeepState (Position const &start, Position const &end, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a tape evaluation but restore the state afterwards such that it is the same as when the evaluation started. It hast to hold start <= end.
 
- Public Member Functions inherited from codi::PositionalEvaluationTapeInterface< T_Position >
void evaluate (Position const &start, Position const &end, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a reverse evaluation for a part of the tape. It hast to hold start >= end.
 
void clearAdjoints (Position const &start, Position const &end, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Clear all adjoints that would be set in a tape evaluation from start to end. It has to hold start >= end.
 
Position getPosition () const
 Current position of the tape.
 
Position getZeroPosition () const
 Initial position of the tape.
 
void resetTo (Position const &pos, bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Reset the tape to the provided position.
 
- Public Member Functions inherited from codi::ForwardEvaluationTapeInterface< T_Position >
void evaluateForward (Position const &start, Position const &end, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a forward evaluation of a part of the tape. It has to hold start <= end.
 
void evaluateForward (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a forward evaluation of the full tape.
 
- Public Member Functions inherited from codi::ManualStatementPushTapeInterface< T_Real, T_Gradient, T_Identifier >
void pushJacobianManual (Real const &jacobian, Real const &value, Identifier const &index)
 
void storeManual (Real const &lhsValue, Identifier &lhsIndex, Config::ArgumentSize const &size)
 

Detailed Description

template<typename T_Real, typename T_Gradient, typename T_Identifier, typename T_Position>
struct codi::PreaccumulationEvaluationTapeInterface< T_Real, T_Gradient, T_Identifier, T_Position >

Perform tape evaluations but ensure that the state prior to evaluation equals the state after evaluation.

See Tape Interface Design for a general overview of the tape interface design in CoDiPack.

These interface functions are used for small tape evaluation where only a part of the tape is evaluated. Especially for primal value tapes, it is essential that the primal value store in the background is in sync with the program state. The normal evaluate methods in these tapes copy the primal value vector and perform all operations on the copied vector. In the *KeepState() methods, they ensure the correctness of the primal value vector by performing e.g. a primal evaluation after the reverse evaluation. This will yield better performance for small tape ranges in the evaluation.

Template Parameters
T_RealThe computation type of a tape, usually chosen as ActiveType::Real.
T_GradientThe gradient type of a tape usually, chosen as ActiveType::Gradient.
T_IdentifierThe adjoint/tangent identification type of a tape, usually chosen as ActiveType::Identifier.
T_PositionGlobal tape position, usually chosen as Tape::Position.

Member Function Documentation

◆ evaluateForwardKeepState()

template<typename T_Real , typename T_Gradient , typename T_Identifier , typename T_Position >
void codi::PreaccumulationEvaluationTapeInterface< T_Real, T_Gradient, T_Identifier, T_Position >::evaluateForwardKeepState ( Position const & start,
Position const & end,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )

Perform a tape evaluation but restore the state afterwards such that it is the same as when the evaluation started. It hast to hold start <= end.

Automatic adjoints management involves bounds checking, resizing, and locking, see AdjointsManagement for details.

◆ evaluateKeepState()

template<typename T_Real , typename T_Gradient , typename T_Identifier , typename T_Position >
void codi::PreaccumulationEvaluationTapeInterface< T_Real, T_Gradient, T_Identifier, T_Position >::evaluateKeepState ( Position const & start,
Position const & end,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )

Perform a tape evaluation but restore the state afterwards such that it is the same as when the evaluation started. It hast to hold start >= end.

Automatic adjoints management involves bounds checking, resizing, and locking, see AdjointsManagement for details.


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