CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl > Struct Template Reference

Implementation of all common tape functionality. More...

#include <commonTapeImplementation.hpp>

Inheritance diagram for codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >:

Public Types

using Gradient = typename ImplTapeTypes::Gradient
 See TapeTypesInterface.
 
using Identifier = typename ImplTapeTypes::Identifier
 See TapeTypesInterface.
 
using Impl = T_Impl
 See CommonTapeImplementation.
 
using ImplTapeTypes = T_ImplTapeTypes
 See CommonTapeImplementation.
 
using LowLevelFunctionByteData = typename CommonTapeTypes<ImplTapeTypes>::LowLevelFunctionByteData
 See CommonTapeTypes.
 
using LowLevelFunctionInfoData = typename CommonTapeTypes<ImplTapeTypes>::LowLevelFunctionInfoData
 See CommonTapeTypes.
 
using NestedData = LowLevelFunctionByteData
 Shorthand.
 
using NestedPosition = typename LowLevelFunctionByteData::Position
 Shorthand.
 
using Position = typename CommonTapeTypes<ImplTapeTypes>::Position
 See TapeTypesInterface.
 
using Real = typename ImplTapeTypes::Real
 See TapeTypesInterface.
 
- Public Types inherited from codi::FullTapeInterface< T_ImplTapeTypes::Real, T_ImplTapeTypes::Gradient, T_ImplTapeTypes::Identifier, CommonTapeTypes< T_ImplTapeTypes >::Position >
using Gradient
 See FullTapeInterface.
 
using Identifier
 See FullTapeInterface.
 
using Position
 See FullTapeInterface.
 
using 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.
 

Public Member Functions

 CommonTapeImplementation ()
 Constructor.
 
 CommonTapeImplementation (CommonTapeImplementation &&)=delete
 Do not allow move construction. Relevant use cases should be covered by swap.
 
 CommonTapeImplementation (CommonTapeImplementation const &)=delete
 Do not allow copy construction.
 
CommonTapeImplementationoperator= (CommonTapeImplementation &&)=delete
 Do not allow move assignment. Relevant use cases should be covered by swap.
 
CommonTapeImplementationoperator= (CommonTapeImplementation const &)=delete
 Do not allow copy assignment.
 
Functions from GradientAccessTapeInterface
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.
 
Functions from ReverseTapeInterface
void evaluate (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a full reverse evaluation of the tape.
 
template<typename Lhs >
void registerOutput (LhsExpressionInterface< Real, Gradient, Impl, 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.
 
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.
 
void reset (bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Reset the tape to the initial state for a fresh recording.
 
Functions from DataManagementTapeInterface
void swap (Impl &other)
 Swap all data with an other tape.
 
void resetHard ()
 Delete everything and return to the state after construction, as far as possible.
 
void writeToFile (const std::string &filename)
 See File IO functions.
 
void readFromFile (const std::string &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.
 
Functions from ExternalFunctionTapeInterface
void pushExternalFunction (ExternalFunction< Impl > const &extFunc)
 
Functions from ForwardEvaluationTapeInterface
void evaluateForward (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a forward evaluation of a part of the tape. It has to hold start <= end.
 
Functions from IdentifierInformationTapeInterface
Identifier getPassiveIndex () const
 Identifier for passive values. Usually 0.
 
Identifier getInvalidIndex () const
 Invalid identifier.
 
bool isIdentifierActive (Identifier const &index) const
 
template<typename Lhs >
void deactivateValue (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 
Functions from PositionalEvaluationTapeInterface
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.
 
Functions from PrimalEvaluationTapeInterface
void evaluatePrimal ()
 Perform a full (forward) reevaluation of the primals in the tape.
 
void setPrimal (Identifier const &identifier, Real const &primal)
 Set primal value.
 
Real const & getPrimal (Identifier const &identifier) const
 Get primal value.
 
- 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.
 

Protected Member Functions

void deleteLowLevelFunctionData (Position const &pos)
 Delete all external function data up to pos.
 
void incrementManualPushCounter ()
 Increment the manual push counter. Check against the declared push goal.
 
void initializeManualPushData (Real const &lhsValue, Identifier const &lhsIndex, size_t size)
 Initialize all manual push data, including the counter. Check that a previous manual store is completed.
 
Interface definition
TapeValues internalGetTapeValues () const
 Create tape values.
 
Internal helper functions
void init (typename ImplTapeTypes::NestedData *nested)
 Initialize the base class.
 

Protected Attributes

bool active
 Whether or not the tape is in recording mode.
 
TemporaryMemory allocator
 Allocator for temporary memory.
 
LowLevelFunctionByteData llfByteData
 Byte data for low level functions.
 
LowLevelFunctionInfoData llfInfoData
 Token and size data for low level functions.
 
size_t manualPushCounter
 Count the pushes after storeManual, to identify the last push.
 
size_t manualPushGoal
 Store the number of expected pushes after a storeManual call.
 
Identifier manualPushLhsIdentifier
 For storeManual, remember the identifier assigned to the lhs.
 
Real manualPushLhsValue
 For storeManual, remember the value assigned to the lhs.
 
std::set< TapeParametersoptions
 All options.
 

Static Protected Attributes

static std::vector< LowLevelFunctionEntry< Impl, Real, Identifier > > * lowLevelFunctionLookup = nullptr
 Lookup table for low level function.
 

Functions from LowLevelFunctionTapeInterface

void internalStoreLowLevelFunction (Config::LowLevelFunctionToken token, size_t size, ByteDataView &dataView)
 Called by the implementing tapes to store a low level function. The size is reserved and allocated. The data view is populated with the pointer and can be used to write the data.
 
TemporaryMemorygetTemporaryMemory ()
 Temporary memory that can be used for dynamic data both during the evaluation and the recording.
 
Config::LowLevelFunctionToken registerLowLevelFunction (LowLevelFunctionEntry< Impl, Real, Identifier > const &entry)
 Register a low level function on the tape.
 
template<LowLevelFunctionEntryCallKind callType, typename... Args>
static void callLowLevelFunction (Impl &impl, bool forward, size_t &curLLFByteDataPos, char *dataPtr, size_t &curLLFTInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr, Args &&... args)
 Called by the implementing tapes during a tape evaluation when a low level function statement has been reached.
 

Additional Inherited Members

- 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_ImplTapeTypes, typename T_Impl>
struct codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >

Implementation of all common tape functionality.

This basic implementation provides the following functionality:

  • external function support with the external functions stored in externalFunctionData,
  • tape options gathering,
  • activity tracking.

It also provides functionality that can be implemented with other functions:

  • setter and getter methods,
  • non-positional evaluation methods,
  • registerOutput,
  • TapeValues functions,
  • reset functionality.
Template Parameters
T_ImplTapeTypesmust implement TapeTypesInterface.
T_ImplType of the full tape implementation.

Member Function Documentation

◆ deactivateValue()

template<typename T_ImplTapeTypes , typename T_Impl >
template<typename Lhs >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::deactivateValue ( LhsExpressionInterface< Real, Gradient, Impl, Lhs > & value)
inline

Modify the value such that it is no longer active.

Template Parameters
LhsClass that implements the LhsExpressionInterface. See also LhsExpressionInterface.
TapeTape implementation used in the LhsExpressionInterface. See also LhsExpressionInterface.

◆ deleteData()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::deleteData ( )
inline

◆ evaluate()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::evaluate ( AdjointsManagement adjointsManagement = AdjointsManagement::Automatic)
inline

Perform a full reverse evaluation of the tape.

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

◆ evaluateForward()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::evaluateForward ( AdjointsManagement adjointsManagement = AdjointsManagement::Automatic)
inline

Perform a forward evaluation of a part of the tape. It has to hold start <= end.

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

◆ evaluatePrimal()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::evaluatePrimal ( )
inline

Perform a full (forward) reevaluation of the primals in the tape.

◆ getAvailableParameters()

template<typename T_ImplTapeTypes , typename T_Impl >
std::set< TapeParameters > const & codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getAvailableParameters ( ) const
inline

◆ getGradient()

template<typename T_ImplTapeTypes , typename T_Impl >
Gradient const & codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getGradient ( Identifier const & identifier,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic ) const
inline

Set the gradient.

Automatic adjoints management involves bounds checking and locking. If no adjoint variable with the given identifier exists, a reference to adjoints[0] is returned. See AdjointsManagement for details.

◆ getInvalidIndex()

template<typename T_ImplTapeTypes , typename T_Impl >
Identifier codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getInvalidIndex ( ) const
inline

Invalid identifier.

◆ getParameter()

template<typename T_ImplTapeTypes , typename T_Impl >
size_t codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getParameter ( TapeParameters parameter) const
inline

See Parameters functions.



Implementation: Handles LLFByteDataSize, LLFInfoDataSize

◆ getPassiveIndex()

template<typename T_ImplTapeTypes , typename T_Impl >
Identifier codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getPassiveIndex ( ) const
inline

Identifier for passive values. Usually 0.

◆ getPosition()

template<typename T_ImplTapeTypes , typename T_Impl >
Position codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getPosition ( ) const
inline

Current position of the tape.

◆ getPrimal()

template<typename T_ImplTapeTypes , typename T_Impl >
Real const & codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getPrimal ( Identifier const & identifier) const
inline

Get primal value.

◆ getTapeValues()

template<typename T_ImplTapeTypes , typename T_Impl >
TapeValues codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getTapeValues ( ) const
inline

Get current tape values.

◆ getTemporaryMemory()

template<typename T_ImplTapeTypes , typename T_Impl >
TemporaryMemory & codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getTemporaryMemory ( )
inline

Temporary memory that can be used for dynamic data both during the evaluation and the recording.

◆ getZeroPosition()

template<typename T_ImplTapeTypes , typename T_Impl >
Position codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::getZeroPosition ( ) const
inline

Initial position of the tape.

◆ hasParameter()

template<typename T_ImplTapeTypes , typename T_Impl >
bool codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::hasParameter ( TapeParameters parameter) const
inline

◆ isActive()

template<typename T_ImplTapeTypes , typename T_Impl >
bool codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::isActive ( ) const
inline

Check if the tape is recording.

◆ isIdentifierActive()

template<typename T_ImplTapeTypes , typename T_Impl >
bool codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::isIdentifierActive ( Identifier const & index) const
inline

True if the identifier is considered active by the tape.

◆ printStatistics()

template<typename T_ImplTapeTypes , typename T_Impl >
template<typename Stream = std::ostream>
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::printStatistics ( Stream & out = std::cout) const
inline

Default formatting of TapeValues.

◆ printTableHeader()

template<typename T_ImplTapeTypes , typename T_Impl >
template<typename Stream = std::ostream>
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::printTableHeader ( Stream & out = std::cout) const
inline

Table header output of TapeValues.

◆ printTableRow()

template<typename T_ImplTapeTypes , typename T_Impl >
template<typename Stream = std::ostream>
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::printTableRow ( Stream & out = std::cout) const
inline

Table row output of TapeValues.

◆ pushExternalFunction()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::pushExternalFunction ( ExternalFunction< Impl > const & extFunc)
inline

Push an external function to the tape.

The external function class can be created via the helper ExternalFunction::create.

◆ readFromFile()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::readFromFile ( const std::string & filename)
inline

◆ registerLowLevelFunction()

template<typename T_ImplTapeTypes , typename T_Impl >
Config::LowLevelFunctionToken codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::registerLowLevelFunction ( LowLevelFunctionEntry< Impl, Real, Identifier > const & entry)
inline

Register a low level function on the tape.

◆ registerOutput()

template<typename T_ImplTapeTypes , typename T_Impl >
template<typename Lhs >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::registerOutput ( LhsExpressionInterface< Real, Gradient, Impl, Lhs > & value)
inline

Mark a value as output (dependent).

Template Parameters
LhsClass that implements the LhsExpressionInterface. See also LhsExpressionInterface.
TapeTape implementation used in the LhsExpressionInterface. See also LhsExpressionInterface.

◆ reset()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::reset ( bool resetAdjoints = true,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )
inline

Reset the tape to the initial state for a fresh recording.

See Tutorial 5 - Repeated tape recordings for remarks on repeated tape recording in CoDiPack.

Automatic adjoints management involves locking, see AdjointsManagement for details.

◆ resetHard()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::resetHard ( )
inline

Delete everything and return to the state after construction, as far as possible.

Unlike other reset methods, this methods involves resizing the adjoint vector, this is not optional. Therefore, no codi::AdjointsManagement parameter is offered.

◆ resetTo()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::resetTo ( Position const & pos,
bool resetAdjoints = true,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )
inline

Reset the tape to the provided position.

Automatic adjoints management involves locking, see AdjointsManagement for details.

◆ setActive()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::setActive ( )
inline

Start/continue recording of statements.

◆ setGradient()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::setGradient ( Identifier const & identifier,
Gradient const & gradient,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )
inline

Set the gradient.

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

◆ setParameter()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::setParameter ( TapeParameters parameter,
size_t value )
inline

See Parameters functions.



Implementation: Handles LLFByteDataSize, LLFInfoDataSize

◆ setPassive()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::setPassive ( )
inline

Stop/interrupt recording of statements.

◆ setPrimal()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::setPrimal ( Identifier const & identifier,
Real const & primal )
inline

Set primal value.

◆ swap()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::swap ( Impl & other)
inline

Swap all data with an other tape.

◆ writeToFile()

template<typename T_ImplTapeTypes , typename T_Impl >
void codi::CommonTapeImplementation< T_ImplTapeTypes, T_Impl >::writeToFile ( const std::string & filename)
inline

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