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

Full tape interface that supports all features of CoDiPack. More...

#include <fullTapeInterface.hpp>

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

Public Types

using Gradient = T_Gradient
 See FullTapeInterface.
 
using Identifier = T_Identifier
 See FullTapeInterface.
 
using Position = T_Position
 See FullTapeInterface.
 
using Real = T_Real
 See FullTapeInterface.
 
- Public Types inherited from codi::CustomAdjointVectorEvaluationTapeInterface< T_Position >
using Position = T_Position
 See CustomAdjointVectorEvaluationTapeInterface.
 
- Public Types inherited from codi::ForwardEvaluationTapeInterface< T_Position >
using Position = T_Position
 See ForwardEvaluationTapeInterface.
 
- Public Types inherited from codi::PositionalEvaluationTapeInterface< T_Position >
using Position = T_Position
 See PositionalEvaluationTapeInterface.
 
- Public Types inherited from codi::DataManagementTapeInterface< T_Real, T_Identifier >
using Identifier = T_Identifier
 See DataManagementTapeInterface.
 
using Real = T_Real
 See DataManagementTapeInterface.
 
- Public Types inherited from codi::ExternalFunctionTapeInterface< T_Real, T_Gradient, T_Identifier >
using Gradient = T_Gradient
 See ExternalFunctionTapeInterface.
 
using Identifier = T_Identifier
 See ExternalFunctionTapeInterface.
 
using Real = T_Real
 See ExternalFunctionTapeInterface.
 
- Public Types inherited from codi::GradientAccessTapeInterface< T_Gradient, T_Identifier >
using Gradient = T_Gradient
 See GradientAccessTapeInterface.
 
using Identifier = T_Identifier
 See GradientAccessTapeInterface.
 
- Public Types inherited from codi::IdentifierInformationTapeInterface< T_Real, T_Gradient, T_Identifier >
using Gradient = T_Gradient
 See IdentifierInformationTapeInterface.
 
using Identifier = T_Identifier
 See IdentifierInformationTapeInterface.
 
using Real = T_Real
 See IdentifierInformationTapeInterface.
 
- Public Types inherited from codi::InternalStatementRecordingTapeInterface< T_Identifier >
using Identifier = T_Identifier
 See InternalStatementRecordingTapeInterface.
 
- Public Types inherited from codi::LowLevelFunctionTapeInterface< T_Real, T_Gradient, T_Identifier >
using Gradient = T_Gradient
 See LowLevelFunctionTapeInterface.
 
using Identifier = T_Identifier
 See LowLevelFunctionTapeInterface.
 
using Real = T_Real
 See LowLevelFunctionTapeInterface.
 
- 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 Types inherited from codi::PreaccumulationEvaluationTapeInterface< T_Real, T_Gradient, T_Identifier, T_Position >
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::PrimalEvaluationTapeInterface< T_Real, T_Identifier, T_Position >
using Identifier = T_Identifier
 See PrimalEvaluationTapeInterface.
 
using Position = T_Position
 See PrimalEvaluationTapeInterface.
 
using Real = T_Real
 See PrimalEvaluationTapeInterface.
 
- Public Types inherited from codi::ReverseTapeInterface< T_Real, T_Gradient, T_Identifier >
using Gradient = T_Gradient
 See ReverseTapeInterface.
 
using Identifier = T_Identifier
 See ReverseTapeInterface.
 
using PassiveReal = RealTraits::PassiveReal< Real >
 Basic computation type.
 
using Real = T_Real
 See ReverseTapeInterface.
 

Additional Inherited Members

- Public Member Functions inherited from codi::CustomAdjointVectorEvaluationTapeInterface< T_Position >
template<typename Adjoint >
void evaluate (Position const &start, Position const &end, Adjoint *data)
 Perform a reverse evaluation for a part of the tape. It hast to hold start >= end.
 
template<typename Adjoint >
void evaluateForward (Position const &start, Position const &end, Adjoint *data)
 Perform a forward evaluation of a part of the tape. It has to hold start <= end.
 
- 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::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::DataManagementTapeInterface< T_Real, T_Identifier >
void writeToFile (std::string const &filename) const
 See File IO functions.
 
void readFromFile (std::string const &filename)
 See File IO functions.
 
void deleteData ()
 See File IO functions.
 
std::set< TapeParameters > const & getAvailableParameters () const
 See Parameters functions.
 
size_t getParameter (TapeParameters parameter) const
 See Parameters functions.
 
bool hasParameter (TapeParameters parameter) const
 See Parameters functions.
 
void setParameter (TapeParameters parameter, size_t value)
 See Parameters functions.
 
VectorAccessInterface< Real, Identifier > * createVectorAccess ()
 See Adjoint vector access.
 
template<typename Adjoint >
VectorAccessInterface< Real, Identifier > * createVectorAccessCustomAdjoints (Adjoint *data)
 See Adjoint vector access.
 
void deleteVectorAccess (VectorAccessInterface< Real, Identifier > *access)
 See Adjoint vector access.
 
void resizeAdjointVector ()
 Explicitly trigger resizing of the adjoint vector. See Adjoint vector management.
 
void deleteAdjointVector ()
 Delete the adjoint vector. See Adjoint vector management.
 
void beginUseAdjointVector ()
 Declare that the adjoint vector is being used. See Adjoint vector management.
 
void endUseAdjointVector ()
 Declare that the adjoint vector is no longer used. See Adjoint vector management.
 
void swap (DataManagementTapeInterface &other)
 Swap all data with an other tape.
 
void resetHard ()
 Delete everything and return to the state after construction, as far as possible.
 
- Public Member Functions inherited from codi::ExternalFunctionTapeInterface< T_Real, T_Gradient, T_Identifier >
template<typename Lhs , typename Tape >
Real registerExternalFunctionOutput (LhsExpressionInterface< Real, Gradient, Tape, Lhs > &value)
 
void pushExternalFunction (ExternalFunction< ExternalFunctionTapeInterface > const &extFunc)
 
- Public Member Functions inherited from codi::GradientAccessTapeInterface< T_Gradient, T_Identifier >
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.
 
Gradientgradient (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.
 
- Public Member Functions inherited from codi::IdentifierInformationTapeInterface< T_Real, T_Gradient, T_Identifier >
Identifier getPassiveIndex () const
 Identifier for passive values. Usually 0.
 
Identifier getInvalidIndex () const
 Invalid identifier.
 
bool isIdentifierActive (Identifier const &index) const
 
template<typename Lhs , typename Tape >
void deactivateValue (LhsExpressionInterface< Real, Gradient, Tape, Lhs > &value)
 
- Public Member Functions inherited from codi::InternalStatementRecordingTapeInterface< T_Identifier >
template<typename Real >
void initIdentifier (Real &value, Identifier &identifier)
 
template<typename Real >
void destroyIdentifier (Real &value, Identifier &identifier)
 Has to be called for each identifier, before it is deallocated.
 
template<typename Lhs , typename Rhs >
void store (Lhs &lhs, Rhs const &rhs)
 Has to be called by an AD variable every time it is assigned.
 
- Public Member Functions inherited from codi::LowLevelFunctionTapeInterface< T_Real, T_Gradient, T_Identifier >
TemporaryMemorygetTemporaryMemory ()
 Temporary memory that can be used for dynamic data both during the evaluation and the recording.
 
void pushLowLevelFunction (Config::LowLevelFunctionToken token, size_t size, ByteDataView &data)
 Push a low level function to the tape.
 
Config::LowLevelFunctionToken registerLowLevelFunction (LowLevelFunctionEntry< LowLevelFunctionTapeInterface, Real, Identifier > const &entry)
 Register a low level function on the 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)
 
- Public Member Functions inherited from codi::PreaccumulationEvaluationTapeInterface< T_Real, T_Gradient, T_Identifier, T_Position >
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::PrimalEvaluationTapeInterface< T_Real, T_Identifier, T_Position >
void evaluatePrimal (Position const &start, Position const &end)
 Perform a partly (forward) reevaluation of the primals in the tape. It has to hold start <= end.
 
void evaluatePrimal ()
 Perform a full (forward) reevaluation of the primals in the tape.
 
void setPrimal (Identifier const &identifier, Real const &gradient)
 Set primal value.
 
Real const & getPrimal (Identifier const &identifier) const
 Get primal value.
 
Realprimal (Identifier const &identifier)
 Writable reference to primal value.
 
Real const & primal (Identifier const &identifier) const
 Read only reference to primal value.
 
void revertPrimals (Position const &pos)
 Revert the primals to the state indicated by pos.
 
- Public Member Functions inherited from codi::ReverseTapeInterface< T_Real, T_Gradient, T_Identifier >
template<typename Lhs , typename Tape >
void registerInput (LhsExpressionInterface< Real, Gradient, Tape, Lhs > &value)
 
template<typename Lhs , typename Tape >
void registerOutput (LhsExpressionInterface< Real, Gradient, Tape, Lhs > &value)
 
void setActive ()
 Start/continue recording of statements.
 
void setPassive ()
 Stop/interrupt recording of statements.
 
bool isActive () const
 Check if the tape is recording.
 
void evaluate (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a full reverse evaluation of the tape.
 
void clearAdjoints (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Clear all adjoint values, that is, set them to zero.
 
void reset (bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Reset the tape to the initial state for a fresh recording.
 
template<typename Stream = std::ostream>
void printStatistics (Stream &out=std::cout) const
 Default formatting of TapeValues.
 
template<typename Stream = std::ostream>
void printTableHeader (Stream &out=std::cout) const
 Table header output of TapeValues.
 
template<typename Stream = std::ostream>
void printTableRow (Stream &out=std::cout) const
 Table row output of TapeValues.
 
TapeValues getTapeValues () const
 Get current tape values.
 
- Static Public Member Functions inherited from codi::LowLevelFunctionTapeInterface< T_Real, T_Gradient, T_Identifier >
template<LowLevelFunctionEntryCallKind callType, typename... Args>
static void callLowLevelFunction (LowLevelFunctionTapeInterface &tape, bool forward, size_t &curLLFByteDataPos, char *dataPtr, size_t &curLLFInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr, Args &&... args)
 Internal function for evaluating a low level function entry.
 
- Static Public Attributes inherited from codi::IdentifierInformationTapeInterface< T_Real, T_Gradient, T_Identifier >
static bool constexpr LinearIndexHandling = false
 
- Static Public Attributes inherited from codi::InternalStatementRecordingTapeInterface< T_Identifier >
static bool constexpr AllowJacobianOptimization
 If certain operations can be hidden from the tape.
 
- Static Public Attributes inherited from codi::PrimalEvaluationTapeInterface< T_Real, T_Identifier, T_Position >
static bool constexpr HasPrimalValues = false
 True if the tape has primal values.
 
static bool constexpr RequiresPrimalRestore
 True if the primal state changes during a reverse or forward evaluation.
 

Detailed Description

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

Full tape interface that supports all features of CoDiPack.

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

A tape that implements this interface correctly can be used in all helper structures of CoDiPack.

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.

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