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

Base class for all standard Primal value tape implementations. More...

#include <primalValueBaseTape.hpp>

Inheritance diagram for codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >:

Classes

struct  CountActiveArguments
 Count all arguments that have non-zero index. More...
 
struct  IncrementForwardLogic
 Perform the adjoint update based on the configuration in codi::Config::VariableAdjointInterfaceInPrimalTapes. More...
 
struct  IncrementReversalLogic
 Perform the adjoint update based on the configuration in codi::Config::VariableAdjointInterfaceInPrimalTapes. More...
 
struct  JacobianExtractionLogic
 Computes Jacobian entries for the event system. More...
 
struct  JacobianStatementGenerator
 
struct  PushIdentfierPassiveAndConstant
 Push all data for each argument. More...
 
struct  Wrap_internalEvaluateForward_EvalStatements
 Additional wrapper that triggers compiler optimizations. More...
 
struct  Wrap_internalEvaluatePrimal_EvalStatements
 Wrapper helper for improved compiler optimizations. More...
 
struct  Wrap_internalEvaluateReverse_EvalStatements
 Additional wrapper that triggers compiler optimizations. More...
 

Public Types

using Base = CommonTapeImplementation<T_TapeTypes, T_Impl>
 Base class abbreviation.
 
using ConstantValueData = typename TapeTypes::ConstantValueData
 See PrimalValueTapeTypes.
 
using EvalHandle = typename TapeTypes::EvalHandle
 See PrimalValueTapeTypes.
 
using Gradient = typename TapeTypes::Gradient
 See TapeTypesInterface.
 
using Identifier = typename TapeTypes::Identifier
 See PrimalValueTapeTypes.
 
using Impl = T_Impl
 See PrimalValueBaseTape.
 
using IndexManager = typename TapeTypes::IndexManager
 See TapeTypesInterface.
 
using NestedPosition = typename ConstantValueData::Position
 See PrimalValueTapeTypes.
 
using PassiveReal = RealTraits::PassiveReal<Real>
 Basic computation type.
 
using PassiveValueData = typename TapeTypes::PassiveValueData
 See PrimalValueTapeTypes.
 
using Position = typename Base::Position
 See TapeTypesInterface.
 
using Real = typename TapeTypes::Real
 See TapeTypesInterface.
 
using RhsIdentifierData = typename TapeTypes::RhsIdentifierData
 See PrimalValueTapeTypes.
 
using StatementData = typename TapeTypes::StatementData
 See PrimalValueTapeTypes.
 
using StatementEvaluator = typename TapeTypes::StatementEvaluator
 See PrimalValueTapeTypes.
 
using TapeTypes
 See PrimalValueBaseTape.
 
template<typename Adjoint >
using VectorAccess
 Vector access type generated by this tape.
 
- Public Types inherited from codi::CommonTapeImplementation< T_TapeTypes, T_Impl >
using Gradient
 See TapeTypesInterface.
 
using Identifier
 See TapeTypesInterface.
 
using Impl
 See CommonTapeImplementation.
 
using ImplTapeTypes
 See CommonTapeImplementation.
 
using LowLevelFunctionByteData
 See CommonTapeTypes.
 
using LowLevelFunctionInfoData
 See CommonTapeTypes.
 
using NestedData
 Shorthand.
 
using NestedPosition
 Shorthand.
 
using Position
 See TapeTypesInterface.
 
using Real
 See TapeTypesInterface.
 
- Public Types inherited from codi::FullTapeInterface< T_Real, T_Gradient, T_Identifier, T_Position >
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.
 
- Public Types inherited from codi::StatementEvaluatorTapeInterface< T_TapeTypes::Real >
using Real
 See StatementEvaluatorTapeInterface.
 
- Public Types inherited from codi::StatementEvaluatorInnerTapeInterface< T_TapeTypes::Real >
using Real
 See StatementEvaluatorInnerTapeInterface.
 

Public Member Functions

 PrimalValueBaseTape ()
 Constructor.
 
Functions from GradientAccessTapeInterface
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.
 
Functions from InternalStatementRecordingTapeInterface
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 (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &lhs, ExpressionInterface< Real, Rhs > const &rhs)
 Has to be called by an AD variable every time it is assigned.
 
template<typename Lhs , typename Rhs >
void store (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &lhs, LhsExpressionInterface< Real, Gradient, Impl, Rhs > const &rhs)
 Has to be called by an AD variable every time it is assigned.

 
template<typename Lhs >
void store (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &lhs, Real const &rhs)
 Has to be called by an AD variable every time it is assigned.

 
Functions from ReverseTapeInterface
template<typename Lhs >
void registerInput (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 
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.
 
Functions from CustomAdjointVectorEvaluationTapeInterface
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.
 
Functions from DataManagementTapeInterface
void swap (Impl &other)
 Swap all data with an other tape.
 
void deleteAdjointVector ()
 Delete the adjoint vector. See Adjoint vector management.
 
void resizeAdjointVector ()
 Explicitly trigger resizing of 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.
 
size_t getParameter (TapeParameters parameter) const
 See Parameters functions.
 
void setParameter (TapeParameters parameter, size_t value)
 See Parameters functions.
 
VectorAccess< Gradient > * createVectorAccess ()
 See Adjoint vector access.
 
template<typename Adjoint >
VectorAccess< Adjoint > * createVectorAccessCustomAdjoints (Adjoint *data)
 See Adjoint vector access.
 
void deleteVectorAccess (VectorAccessInterface< Real, Identifier > *access)
 See Adjoint vector access.
 
Functions from ExternalFunctionTapeInterface
template<typename Lhs >
Real registerExternalFunctionOutput (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 
Functions from ForwardEvaluationTapeInterface
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.
 
Functions from ManualStatementPushTapeInterface
void pushJacobianManual (Real const &jacobian, Real const &value, Identifier const &index)
 
void storeManual (Real const &lhsValue, Identifier &lhsIndex, Config::ArgumentSize const &size)
 
Functions from LowLevelFunctionTapeInterface
void pushLowLevelFunction (Config::LowLevelFunctionToken token, size_t size, ByteDataView &data)
 Push a low level function to the tape.
 
Functions from PositionalEvaluationTapeInterface
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 resetTo (Position const &pos, bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Reset the tape to the provided position.
 
Functions from PreaccumulationEvaluationTapeInterface
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.
 
Functions from PrimalEvaluationTapeInterface
void evaluatePrimal (Position const &start, Position const &end)
 Perform a full (forward) reevaluation of the primals in the tape.
 
Realprimal (Identifier const &identifier)
 Writable reference to primal value.
 
Real const & primal (Identifier const &identifier) const
 Read only reference to primal value.
 
- Public Member Functions inherited from codi::CommonTapeImplementation< T_TapeTypes, T_Impl >
 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.
 
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.
 
void evaluate (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a full reverse evaluation of the tape.
 
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.
 
void printStatistics (Stream &out=std::cout) const
 Default formatting of TapeValues.
 
void printTableHeader (Stream &out=std::cout) const
 Table header output of TapeValues.
 
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.
 
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.
 
void pushExternalFunction (ExternalFunction< Impl > const &extFunc)
 
void evaluateForward (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a forward evaluation of a part of the tape. It has to hold start <= end.
 
Identifier getPassiveIndex () const
 Identifier for passive values. Usually 0.
 
Identifier getInvalidIndex () const
 Invalid identifier.
 
bool isIdentifierActive (Identifier const &index) const
 
void deactivateValue (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 
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.
 
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.
 
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.
 
- 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

Function from StatementEvaluatorInnerTapeInterface
template<typename Rhs >
static Real statementEvaluateForwardInner (Real *primalVector, Gradient *adjointVector, Gradient &lhsTangent, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Evaluate expression in a forward mode.
 
template<typename Func >
static Real statementEvaluateForwardFull (Func const &evalInner, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Real *primalVector, Gradient *adjointVector, Gradient &lhsTangent, Config::ArgumentSize numberOfPassiveArguments, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curPassivePos, Real const *const passiveValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Load the expression data and evaluate the expression in a forward mode.
 
template<typename Rhs >
static Real statementEvaluatePrimalInner (Real *primalVector, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Evaluate expression in a primal setting.
 
template<typename Func >
static Real statementEvaluatePrimalFull (Func const &evalInner, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Real *primalVector, Config::ArgumentSize numberOfPassiveArguments, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curPassivePos, Real const *const passiveValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Load the expression data and evaluate the expression in a primal setting.
 
template<typename Rhs >
static void statementEvaluateReverseInner (Real *primalVector, Gradient *adjointVector, Gradient lhsAdjoint, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Evaluate expression in a reverse mode.
 
template<typename Func >
static void statementEvaluateReverseFull (Func const &evalInner, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Real *primalVector, Gradient *adjointVector, Gradient lhsAdjoint, Config::ArgumentSize numberOfPassiveArguments, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curPassivePos, Real const *const passiveValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Load the expression data and evaluate the expression in a reverse mode.
 
- 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 Member Functions inherited from codi::StatementEvaluatorTapeInterface< T_TapeTypes::Real >
static Real statementEvaluateForward (Args &&... args)
 Evaluate expression in a forward mode.
 
static Real statementEvaluatePrimal (Args &&... args)
 Evaluate primal expression.
 
static void statementEvaluateReverse (Args &&... args)
 Evaluate expression in a reverse mode.
 
- Static Public Member Functions inherited from codi::StatementEvaluatorInnerTapeInterface< T_TapeTypes::Real >
static Real statementEvaluateForwardFull (Func const &inner, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Args &&... args)
 Load the expression data and evaluate the expression in a forward mode.
 
static Real statementEvaluatePrimalFull (Func const &inner, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Args &&... args)
 Load the expression data and evaluate the expression in a primal setting.
 
static void statementEvaluateReverseFull (Func const &inner, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Args &&... args)
 Load the expression data and evaluate the expression in a reverse mode.
 
static Real statementEvaluateForwardInner (Args &&... args)
 Evaluate expression in a forward mode.
 
static Real statementEvaluatePrimalInner (Args &&... args)
 Evaluate expression in a primal setting.
 
static void statementEvaluateReverseInner (Args &&... args)
 Evaluate expression in a reverse mode.
 

Public Attributes

friend Base
 Allow the base class to call protected and private methods.
 

Static Public Attributes

static bool constexpr AllowJacobianOptimization = false
 See InternalStatementRecordingTapeInterface.
 
static bool constexpr HasPrimalValues = true
 See PrimalEvaluationTapeInterface.
 
static bool constexpr LinearIndexHandling
 See IdentifierInformationTapeInterface.
 
static bool constexpr RequiresPrimalRestore
 See PrimalEvaluationTapeInterface.
 
- 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.
 

Protected Member Functions

template<bool copyPrimal, typename Adjoint >
void internalEvaluateForward (Position const &start, Position const &end, Adjoint *data)
 Internal method for the forward evaluation of the whole tape.
 
template<bool copyPrimal, typename Adjoint >
void internalEvaluateReverse (Position const &start, Position const &end, Adjoint *data)
 Internal method for the reverse evaluation of the whole tape.
 
TapeValues internalGetTapeValues () const
 
template<typename Lhs >
Real internalRegisterInput (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value, bool unusedIndex)
 Add a new input to the tape and update the primal value vector.
 
template<typename Adjoint >
GradientselectAdjointVector (VectorAccess< Adjoint > *vectorAccess, Adjoint *data)
 Select the configured adjoint vector, see codi::Config::VariableAdjointInterfaceInPrimalTapes.
 
- Protected Member Functions inherited from codi::CommonTapeImplementation< T_TapeTypes, T_Impl >
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.
 
TapeValues internalGetTapeValues () const
 Create tape values.
 
void init (typename ImplTapeTypes::NestedData *nested)
 Initialize the base class.
 
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.
 

Protected Attributes

std::vector< Gradientadjoints
 Evaluation vector for AD.
 
ConstantValueData constantValueData
 Data stream for constant argument data.
 
MemberStore< IndexManager, Impl, TapeTypes::IsStaticIndexHandler > indexManager
 Index manager.
 
PassiveValueData passiveValueData
 Data stream for passive argument value data.
 
std::vector< Realprimals
 Current state of primal values in the program.
 
std::vector< RealprimalsCopy
 Copy of primal values for AD evaluations.
 
RhsIdentifierData rhsIdentiferData
 Data stream for argument identifier data.
 
StatementData statementData
 Data stream for statement specific data.
 
- Protected Attributes inherited from codi::CommonTapeImplementation< T_TapeTypes, T_Impl >
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 EvalHandle const jacobianExpressions [Config::MaxArgumentSize]
 Expressions for manual statement pushes.
 
- Static Protected Attributes inherited from codi::CommonTapeImplementation< T_TapeTypes, T_Impl >
static std::vector< LowLevelFunctionEntry< Impl, Real, Identifier > > * lowLevelFunctionLookup
 Lookup table for low level function.
 

Function from StatementEvaluatorTapeInterface

template<typename Rhs >
static Real statementEvaluateForward (Real *primalVector, Gradient *adjointVector, Gradient &lhsTangent, Config::ArgumentSize numberOfPassiveArguments, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curPassivePos, Real const *const passiveValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Evaluate expression in a forward mode.
 
template<typename Rhs >
static Real statementEvaluatePrimal (Real *primalVector, Config::ArgumentSize numberOfPassiveArguments, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curPassivePos, Real const *const passiveValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Evaluate primal expression.
 
template<typename Rhs >
static void statementEvaluateReverse (Real *primalVector, Gradient *adjointVector, Gradient lhsAdjoint, Config::ArgumentSize numberOfPassiveArguments, size_t &curConstantPos, PassiveReal const *const constantValues, size_t &curPassivePos, Real const *const passiveValues, size_t &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers)
 Evaluate expression in a reverse mode.
 

Interface definition

template<typename... Args>
static void internalEvaluateForward_EvalStatements (Args &&... args)
 Perform a forward evaluation of the tape. Arguments are from the recursive eval methods of the DataInterface.
 
template<typename... Args>
static void internalEvaluatePrimal_EvalStatements (Args &&... args)
 Perform a primal evaluation of the tape. Arguments are from the recursive eval methods of the DataInterface.
 
template<typename... Args>
static void internalEvaluateReverse_EvalStatements (Args &&... args)
 Perform a reverse evaluation of the tape. Arguments are from the recursive eval methods of the DataInterface.
 
void internalResetPrimalValues (Position const &pos)
 Reset the primal values to the given position.
 
void pushStmtData (Identifier const &index, Config::ArgumentSize const &numberOfPassiveArguments, Real const &oldPrimalValue, EvalHandle evalHandle)
 Add statement specific data to the data streams.
 

Additional Inherited Members

- Static Protected Member Functions inherited from codi::CommonTapeImplementation< T_TapeTypes, T_Impl >
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.
 

Detailed Description

template<typename T_TapeTypes, typename T_Impl>
struct codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >

Base class for all standard Primal value tape implementations.

This class provides nearly a full implementation of the FullTapeInterface. There are just a few internal methods left which need to be implemented by the final classes. These methods depend significantly on the index management scheme and are performance critical.

Tape evaluations are performed in several steps. Each methods calls the next method:

  • evaluate
  • internalEvaluate*
  • internalEvaluate*_EvalStatements The placeholder stands for Reverse, Forward, or Primal.
Template Parameters
T_TapeTypesneeds to implement PrimalValueTapeTypes.
T_ImplType of the final implementations

Member Typedef Documentation

◆ TapeTypes

template<typename T_TapeTypes , typename T_Impl >
using codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::TapeTypes
Initial value:
T_TapeTypes

See PrimalValueBaseTape.

◆ VectorAccess

template<typename T_TapeTypes , typename T_Impl >
template<typename Adjoint >
using codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::VectorAccess
Initial value:
PrimalAdjointVectorAccess<Real, Identifier, Adjoint>

Vector access type generated by this tape.

Member Function Documentation

◆ beginUseAdjointVector()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::beginUseAdjointVector ( )
inline

Declare that the adjoint vector is being used. See Adjoint vector management.


Implementation: Empty since primal value tapes do not implement adjoints locking.

◆ clearAdjoints()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::clearAdjoints ( AdjointsManagement adjointsManagement = AdjointsManagement::Automatic)
inline

Clear all adjoint values, that is, set them to zero.

Automatic adjoints management involves locking, see AdjointsManagement for details.
Implementation: Automatic adjoints management has no effect. Primal value tapes do not implement adjoints locking.

◆ createVectorAccess()

template<typename T_TapeTypes , typename T_Impl >
VectorAccess< Gradient > * codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::createVectorAccess ( )
inline

◆ createVectorAccessCustomAdjoints()

template<typename T_TapeTypes , typename T_Impl >
template<typename Adjoint >
VectorAccess< Adjoint > * codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::createVectorAccessCustomAdjoints ( Adjoint * data)
inline

◆ deleteAdjointVector()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::deleteAdjointVector ( )
inline

Delete the adjoint vector. See Adjoint vector management.

◆ deleteVectorAccess()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::deleteVectorAccess ( VectorAccessInterface< Real, Identifier > * access)
inline

◆ destroyIdentifier()

template<typename T_TapeTypes , typename T_Impl >
template<typename Real >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::destroyIdentifier ( Real & value,
Identifier & identifier )
inline

Has to be called for each identifier, before it is deallocated.

◆ endUseAdjointVector()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::endUseAdjointVector ( )
inline

Declare that the adjoint vector is no longer used. See Adjoint vector management.


Implementation: Empty since primal value tapes do not implement adjoints locking.

◆ evaluate() [1/2]

template<typename T_TapeTypes , typename T_Impl >
template<typename Adjoint >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::evaluate ( Position const & start,
Position const & end,
Adjoint * data )
inline

Perform a reverse evaluation for a part of the tape. It hast to hold start >= end.

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

Template Parameters
AdjointSee CustomAdjointVectorEvaluationTapeInterface documentation.

◆ evaluate() [2/2]

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::evaluate ( Position const & start,
Position const & end,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )
inline

Perform a reverse evaluation for a part of the tape. It hast to hold start >= end.

Automatic adjoints management involves bounds checking, resizing, and locking, see AdjointsManagement for details.
Implementation: Automatic adjoints management only involves bounds checking and resizing. Primal value tapes do not implement adjoints locking.

◆ evaluateForward() [1/2]

template<typename T_TapeTypes , typename T_Impl >
template<typename Adjoint >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::evaluateForward ( Position const & start,
Position const & end,
Adjoint * data )
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.

Template Parameters
AdjointSee CustomAdjointVectorEvaluationTapeInterface documentation.

◆ evaluateForward() [2/2]

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::evaluateForward ( Position const & start,
Position const & end,
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.
Implementation: Automatic adjoints management only involves bounds checking and resizing. Primal value tapes do not implement adjoints locking.

◆ evaluateForwardKeepState()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::evaluateForwardKeepState ( Position const & start,
Position const & end,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )
inline

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.
Implementation: Automatic adjoints management only involves bounds checking and resizing. Primal value tapes do not implement adjoints locking.

◆ evaluateKeepState()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::evaluateKeepState ( Position const & start,
Position const & end,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )
inline

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.
Implementation: Automatic adjoints management only involves bounds checking and resizing. Primal value tapes do not implement adjoints locking.

◆ evaluatePrimal()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::evaluatePrimal ( Position const & start,
Position const & end )
inline

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

◆ getParameter()

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

◆ gradient() [1/2]

template<typename T_TapeTypes , typename T_Impl >
Gradient & codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::gradient ( Identifier const & identifier,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic )
inline

Reference access to gradient.

Automatic adjoints management involves bounds checking, resizing, and locking, see AdjointsManagement for details.
Implementation: Automatic adjoints management only involves bounds checking and resizing. Primal value tapes do not implement adjoints locking.

◆ gradient() [2/2]

template<typename T_TapeTypes , typename T_Impl >
Gradient const & codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::gradient ( Identifier const & identifier,
AdjointsManagement adjointsManagement = AdjointsManagement::Automatic ) const
inline

Constant reference access to 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.
Implementation: Automatic adjoints management only involves bounds checking. Primal value tapes do not implement adjoints locking.

◆ initIdentifier()

template<typename T_TapeTypes , typename T_Impl >
template<typename Real >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::initIdentifier ( Real & value,
Identifier & identifier )
inline

Has to be called for each identifier, after it is allocated.

◆ internalGetTapeValues()

template<typename T_TapeTypes , typename T_Impl >
TapeValues codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::internalGetTapeValues ( ) const
inlineprotected

Adds data from all streams, the size of the adjoint vector, the size of the primal vector, and index manager data.

◆ primal() [1/2]

template<typename T_TapeTypes , typename T_Impl >
Real & codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::primal ( Identifier const & identifier)
inline

Writable reference to primal value.

◆ primal() [2/2]

template<typename T_TapeTypes , typename T_Impl >
Real const & codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::primal ( Identifier const & identifier) const
inline

Read only reference to primal value.

◆ pushJacobianManual()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::pushJacobianManual ( Real const & jacobian,
Real const & value,
Identifier const & index )
inline

Push a Jacobian entry to the tape. storeManual() has to be called first and is passed the number of arguments. Afterwards, this method has to be called once for each argument.

Parameters
jacobianJacobian $ \frac{\d \phi}{\d u_i} $ of the argument $ u_i $.
valueValue of the argument $ u_i $. Usually u_i.value().
indexIdentifier of the argument $ u_i $. Usually u_i.identifier().

◆ pushLowLevelFunction()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::pushLowLevelFunction ( Config::LowLevelFunctionToken token,
size_t size,
ByteDataView & data )
inline

Push a low level function to the tape.

Allocates memory with the requested size on the byte data stream. data is initialized for accessing this allocated memory. After the call, it can be used to write data to the data stream. token is the token from registerLowLevelFunction.

See LowLevelFunctionTapeInterface for the expected data layout.

◆ registerExternalFunctionOutput()

template<typename T_TapeTypes , typename T_Impl >
template<typename Lhs >
Real codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::registerExternalFunctionOutput ( LhsExpressionInterface< Real, Gradient, Impl, Lhs > & value)
inline

Register an external function output on the tape.

Returns
For primal value tapes, the return value has to be stored by the external function. The value has to be restored with a call to adjointInterface.setPrimal() during the evaluation of the external function in reverse mode. For this purpose, the primal value is identified by the index which the variable received when it was registered with registerExternalFunctionOutput.
Template Parameters
LhsClass that implements the LhsExpressionInterface. See also LhsExpressionInterface.
TapeTape implementation used in the LhsExpressionInterface. See also LhsExpressionInterface.

◆ registerInput()

template<typename T_TapeTypes , typename T_Impl >
template<typename Lhs >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::registerInput ( LhsExpressionInterface< Real, Gradient, Impl, Lhs > & value)
inline

Mark a value as input (independent) and make it active.

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

◆ reset()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, 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.
Implementation: Automatic adjoints management has no effect. Primal value tapes do not implement adjoints locking.

◆ resetTo()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, 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.
Implementation: Automatic adjoints management has no effect. Primal value tapes do not implement adjoints locking.

◆ resizeAdjointVector()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::resizeAdjointVector ( )
inline

Explicitly trigger resizing of the adjoint vector. See Adjoint vector management.

◆ setParameter()

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

◆ statementEvaluateForward()

template<typename T_TapeTypes , typename T_Impl >
template<typename Rhs >
static Real codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluateForward ( Real * primalVector,
Gradient * adjointVector,
Gradient & lhsTangent,
Config::ArgumentSize numberOfPassiveArguments,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curPassivePos,
Real const *const passiveValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Evaluate expression in a forward mode.

◆ statementEvaluateForwardFull()

template<typename T_TapeTypes , typename T_Impl >
template<typename Func >
static Real codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluateForwardFull ( Func const & evalInner,
size_t const & maxActiveArgs,
size_t const & maxConstantArgs,
Real * primalVector,
Gradient * adjointVector,
Gradient & lhsTangent,
Config::ArgumentSize numberOfPassiveArguments,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curPassivePos,
Real const *const passiveValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Load the expression data and evaluate the expression in a forward mode.

◆ statementEvaluateForwardInner()

template<typename T_TapeTypes , typename T_Impl >
template<typename Rhs >
static Real codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluateForwardInner ( Real * primalVector,
Gradient * adjointVector,
Gradient & lhsTangent,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Evaluate expression in a forward mode.

◆ statementEvaluatePrimal()

template<typename T_TapeTypes , typename T_Impl >
template<typename Rhs >
static Real codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluatePrimal ( Real * primalVector,
Config::ArgumentSize numberOfPassiveArguments,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curPassivePos,
Real const *const passiveValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Evaluate primal expression.

◆ statementEvaluatePrimalFull()

template<typename T_TapeTypes , typename T_Impl >
template<typename Func >
static Real codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluatePrimalFull ( Func const & evalInner,
size_t const & maxActiveArgs,
size_t const & maxConstantArgs,
Real * primalVector,
Config::ArgumentSize numberOfPassiveArguments,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curPassivePos,
Real const *const passiveValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Load the expression data and evaluate the expression in a primal setting.

◆ statementEvaluatePrimalInner()

template<typename T_TapeTypes , typename T_Impl >
template<typename Rhs >
static Real codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluatePrimalInner ( Real * primalVector,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Evaluate expression in a primal setting.

◆ statementEvaluateReverse()

template<typename T_TapeTypes , typename T_Impl >
template<typename Rhs >
static void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluateReverse ( Real * primalVector,
Gradient * adjointVector,
Gradient lhsAdjoint,
Config::ArgumentSize numberOfPassiveArguments,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curPassivePos,
Real const *const passiveValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Evaluate expression in a reverse mode.

◆ statementEvaluateReverseFull()

template<typename T_TapeTypes , typename T_Impl >
template<typename Func >
static void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluateReverseFull ( Func const & evalInner,
size_t const & maxActiveArgs,
size_t const & maxConstantArgs,
Real * primalVector,
Gradient * adjointVector,
Gradient lhsAdjoint,
Config::ArgumentSize numberOfPassiveArguments,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curPassivePos,
Real const *const passiveValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Load the expression data and evaluate the expression in a reverse mode.

◆ statementEvaluateReverseInner()

template<typename T_TapeTypes , typename T_Impl >
template<typename Rhs >
static void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::statementEvaluateReverseInner ( Real * primalVector,
Gradient * adjointVector,
Gradient lhsAdjoint,
size_t & curConstantPos,
PassiveReal const *const constantValues,
size_t & curRhsIdentifiersPos,
Identifier const *const rhsIdentifiers )
inlinestatic

Evaluate expression in a reverse mode.

◆ store() [1/3]

template<typename T_TapeTypes , typename T_Impl >
template<typename Lhs , typename Rhs >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::store ( LhsExpressionInterface< Real, Gradient, Impl, Lhs > & lhs,
ExpressionInterface< Real, Rhs > const & rhs )
inline

Has to be called by an AD variable every time it is assigned.

Update of the value is performed by the tape. The tape will additionally store information, e.g., for the reversal of the statement.

Template Parameters
LhsHas to implement LhsExpressionInterface.
RhsHas to implement ExpressionInterface.

◆ store() [2/3]

template<typename T_TapeTypes , typename T_Impl >
template<typename Lhs , typename Rhs >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::store ( LhsExpressionInterface< Real, Gradient, Impl, Lhs > & lhs,
LhsExpressionInterface< Real, Gradient, Impl, Rhs > const & rhs )
inline

Has to be called by an AD variable every time it is assigned.

Update of the value is performed by the tape. The tape will additionally store information, e.g., for the reversal of the statement.

Template Parameters
LhsHas to implement LhsExpressionInterface.
RhsHas to implement ExpressionInterface.
Optimization for copy statements.

◆ store() [3/3]

template<typename T_TapeTypes , typename T_Impl >
template<typename Lhs >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::store ( LhsExpressionInterface< Real, Gradient, Impl, Lhs > & lhs,
Real const & rhs )
inline

Has to be called by an AD variable every time it is assigned.

Update of the value is performed by the tape. The tape will additionally store information, e.g., for the reversal of the statement.

Template Parameters
LhsHas to implement LhsExpressionInterface.
RhsHas to implement ExpressionInterface.
Specialization for passive assignments.

◆ storeManual()

template<typename T_TapeTypes , typename T_Impl >
void codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::storeManual ( Real const & lhsValue,
Identifier & lhsIndex,
Config::ArgumentSize const & size )
inline

Initialize the storing of a hand computed statement. The primal value has to be updated already.

Parameters
lhsValueValue of the result $ w $. Usually w.value().
lhsIndexIdentifier of the result $ w $. Usually w.identifier().
sizeNumber of arguments of $ \phi $.

◆ swap()

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

Swap all data with an other tape.

Member Data Documentation

◆ LinearIndexHandling

template<typename T_TapeTypes , typename T_Impl >
bool constexpr codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::LinearIndexHandling
staticconstexpr
Initial value:
=
TapeTypes::IsLinearIndexHandler

See IdentifierInformationTapeInterface.

◆ RequiresPrimalRestore

template<typename T_TapeTypes , typename T_Impl >
bool constexpr codi::PrimalValueBaseTape< T_TapeTypes, T_Impl >::RequiresPrimalRestore
staticconstexpr
Initial value:
=
!TapeTypes::IsLinearIndexHandler

See PrimalEvaluationTapeInterface.


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