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

Base class for all standard Jacobian tape implementations. More...

#include <jacobianBaseTape.hpp>

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

Classes

struct  PushDelayedJacobianLogic
 Pushes all delayed Jacobians. More...
 
struct  PushJacobianLogic
 Pushes Jacobians and indices to the tape. More...
 
struct  Wrap_internalEvaluateForward_EvalStatements
 Wrapper helper for improved compiler optimizations. More...
 
struct  Wrap_internalEvaluateReverse_EvalStatements
 Wrapper helper for improved compiler optimizations. More...
 

Public Types

using Adjoints = typename TapeTypes::template Adjoints<Impl>
 See JacobianTapeTypes.
 
using Base = CommonTapeImplementation<T_TapeTypes, T_Impl>
 Base class abbreviation.
 
using Gradient = typename TapeTypes::Gradient
 See TapeTypesInterface.
 
using Identifier = typename TapeTypes::Identifier
 See TapeTypesInterface.
 
using Impl = T_Impl
 See JacobianBaseTape.
 
using IndexManager = typename TapeTypes::IndexManager
 See JacobianTapeTypes.
 
using JacobianData = typename TapeTypes::JacobianData
 See JacobianTapeTypes.
 
using NestedPosition = typename JacobianData::Position
 See JacobianTapeTypes.
 
using PassiveReal = RealTraits::PassiveReal<Real>
 Basic computation type.
 
using Position = typename Base::Position
 See TapeTypesInterface.
 
using Real = typename TapeTypes::Real
 See TapeTypesInterface.
 
using StatementData = typename TapeTypes::StatementData
 See JacobianTapeTypes.
 
using TapeTypes
 See JacobianBaseTape.
 
template<typename AdjointVector>
using VectorAccess = AdjointVectorAccess<Real, Identifier, AdjointVector>
 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_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier, CommonTapeTypes< T_TapeTypes >::Position >
using Gradient
 See FullTapeInterface.
 
using Identifier
 See FullTapeInterface.
 
using Position
 See FullTapeInterface.
 
using Real
 See FullTapeInterface.
 
- Public Types inherited from codi::CustomAdjointVectorEvaluationTapeInterface< CommonTapeTypes< T_TapeTypes >::Position >
using Position
 See CustomAdjointVectorEvaluationTapeInterface.
 
- Public Types inherited from codi::ForwardEvaluationTapeInterface< CommonTapeTypes< T_TapeTypes >::Position >
using Position
 See ForwardEvaluationTapeInterface.
 
- Public Types inherited from codi::PositionalEvaluationTapeInterface< CommonTapeTypes< T_TapeTypes >::Position >
using Position
 See PositionalEvaluationTapeInterface.
 
- Public Types inherited from codi::DataManagementTapeInterface< T_TapeTypes::Real, T_TapeTypes::Identifier >
using Identifier
 See DataManagementTapeInterface.
 
using Real
 See DataManagementTapeInterface.
 
- Public Types inherited from codi::ExternalFunctionTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier >
using Gradient
 See ExternalFunctionTapeInterface.
 
using Identifier
 See ExternalFunctionTapeInterface.
 
using Real
 See ExternalFunctionTapeInterface.
 
- Public Types inherited from codi::GradientAccessTapeInterface< T_TapeTypes::Gradient, T_TapeTypes::Identifier >
using Gradient
 See GradientAccessTapeInterface.
 
using Identifier
 See GradientAccessTapeInterface.
 
- Public Types inherited from codi::IdentifierInformationTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier >
using Gradient
 See IdentifierInformationTapeInterface.
 
using Identifier
 See IdentifierInformationTapeInterface.
 
using Real
 See IdentifierInformationTapeInterface.
 
- Public Types inherited from codi::InternalStatementRecordingTapeInterface< T_TapeTypes::Identifier >
using Identifier
 See InternalStatementRecordingTapeInterface.
 
- Public Types inherited from codi::LowLevelFunctionTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier >
using Gradient
 See LowLevelFunctionTapeInterface.
 
using Identifier
 See LowLevelFunctionTapeInterface.
 
using Real
 See LowLevelFunctionTapeInterface.
 
- Public Types inherited from codi::ManualStatementPushTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier >
using Gradient
 See ManualStatementPushTapeInterface.
 
using Identifier
 See ManualStatementPushTapeInterface.
 
using Real
 See ManualStatementPushTapeInterface.
 
- Public Types inherited from codi::PreaccumulationEvaluationTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier, CommonTapeTypes< T_TapeTypes >::Position >
using Gradient
 See PreaccumulationEvaluationTapeInterface.
 
using Identifier
 See PreaccumulationEvaluationTapeInterface.
 
using Position
 See PreaccumulationEvaluationTapeInterface.
 
using Real
 See PreaccumulationEvaluationTapeInterface.
 
- Public Types inherited from codi::PrimalEvaluationTapeInterface< T_TapeTypes::Real, T_TapeTypes::Identifier, CommonTapeTypes< T_TapeTypes >::Position >
using Identifier
 See PrimalEvaluationTapeInterface.
 
using Position
 See PrimalEvaluationTapeInterface.
 
using Real
 See PrimalEvaluationTapeInterface.
 
- Public Types inherited from codi::ReadWriteTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier, CommonTapeTypes< T_TapeTypes >::Position >
using EvalHandle
 See PrimalValueTapeTypes.
 
using Gradient
 See ReadWriteTapeInterface.
 
using Identifier
 See ReadWriteTapeInterface.
 
using Position
 See ReadWriteTapeInterface.
 
using Real
 See ReadWriteTapeInterface.
 
using Type
 Provided by the template arguments in the writeTape methods.
 
using WriterInterface
 Writer interface.
 
using WriterInterfaceUniquePtr
 Unique pointer to writer.
 
- Public Types inherited from codi::ReverseTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier >
using Gradient
 See ReverseTapeInterface.
 
using Identifier
 See ReverseTapeInterface.
 
using PassiveReal
 Basic computation type.
 
using Real
 See ReverseTapeInterface.
 

Public Member Functions

 JacobianBaseTape ()
 Constructor.
 
Functions from GradientAccessTapeInterface
inlineGradient & gradient (Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Reference access to gradient.
 
inlineGradient const & gradient (Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const
 Constant reference access to gradient.
 
Functions from InternalStatementRecordingTapeInterface
template<typename Real>
inlinevoid initIdentifier (Real &value, Identifier &identifier)
 
template<typename Real>
inlinevoid destroyIdentifier (Real &value, Identifier &identifier)
 Has to be called for each identifier, before it is deallocated.
 
template<typename Aggregated, typename Type, typename Lhs, typename Rhs>
inlinevoid store (AggregatedActiveType< Aggregated, Type, Lhs > &lhs, ExpressionInterface< Aggregated, Rhs > const &rhs)
 Has to be called by an AD variable every time it is assigned.

 
template<typename Aggregated, typename Type, typename Lhs, typename Rhs>
inlinevoid store (AggregatedActiveType< Aggregated, Type, Lhs > &lhs, AggregatedActiveType< Aggregated, Type, Rhs > const &rhs)
 Has to be called by an AD variable every time it is assigned.

 
template<typename Lhs, typename Rhs>
inlinevoid 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>
inlinevoid 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>
inlinevoid 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>
inlinevoid registerInput (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 
inlinevoid clearAdjoints (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Clear all adjoint values, that is, set them to zero.
 
Functions from CustomAdjointVectorEvaluationTapeInterface
template<typename AdjointVector>
void evaluate (Position const &start, Position const &end, AdjointVector &&data)
 Perform a reverse evaluation for a part of the tape. It hast to hold start >= end.
 
template<typename AdjointVector>
void evaluateForward (Position const &start, Position const &end, AdjointVector &&data)
 Perform a reverse evaluation for a part of the tape. It hast to hold start >= end.
 
 inlinedecltype (adjoints.data()) getInternalAdjoints()
 Obtain a representation of the tape's internal adjoint vector that can be used as custom adjoints.
 
void evaluate (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a full reverse evaluation of the tape.
 
Functions from DataManagementTapeInterface
inlinevoid 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< decltype(adjoints.data())> * createVectorAccess ()
 See Adjoint vector access.
 
template<typename AdjointVector>
VectorAccess< AdjointVector > * createVectorAccessCustomAdjoints (AdjointVector &&data)
 
template<typename Adjoint>
VectorAccess< Adjoint * > * createVectorAccessCustomAdjoints (Adjoint *data)
 
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.
 
void evaluateForward (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 ReadWriteTapeInterface
void createStatementManual (Real const &lhsValue, Identifier &lhsIndex, Config::ArgumentSize const &size, Real const *jacobians, Identifier const *rhsIdentifiers)
 
template<typename Type>
void writeTape (codi::TapeWriterInterface< Type > *writer, Position const &start, Position const &end)
 For full or partial tapes using a pointer to the writer.
 
void writeTape (std::unique_ptr< TapeWriterInterface< Type > > writer)
 For full-tape writers using a smart pointer.
 
void writeTape (std::unique_ptr< TapeWriterInterface< Type > > writer, Position const &start, Position const &end)
 For partial-tape writers using a smart pointer.
 
void writeTape (codi::TapeWriterInterface< Type > &writeToFileRef)
 For full-tape writers using a manually generated writers.
 
void writeTape (codi::TapeWriterInterface< Type > &writeToFileRef, Position const &start, Position const &end)
 For partial-tape writers using a manually generated writers.
 
Functions from IdentifierInformationTapeInterface
IndexManagergetIndexManager ()
 Returns a reference to the Index Manager.
 
Functions from LowLevelFunctionTapeInterface
inlinevoid pushLowLevelFunction (Config::LowLevelFunctionToken token, size_t size, ByteDataView &data)
 Push a low level function to the tape.
 
Functions from PositionalEvaluationTapeInterface
inlinevoid 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.
 
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.
 
template<typename AdjointVector>
void evaluateKeepState (Position const &start, Position const &end, AdjointVector &&data)
 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.
 
template<typename AdjointVector>
void evaluateForwardKeepState (Position const &start, Position const &end, AdjointVector &&data)
 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)
 Not implemented, raises an exception.
 
Realprimal (Identifier const &identifier)
 Not implemented, raises an exception.
 
Real const & primal (Identifier const &identifier) const
 Not implemented, raises an exception.
 
void evaluatePrimal ()
 Perform a full (forward) reevaluation of the primals in the tape.
 
- Public Member Functions inherited from codi::CommonTapeImplementation< T_TapeTypes, T_Impl >
 CommonTapeImplementation ()
 Constructor.
 
 CommonTapeImplementation ()
 Constructor.
 
 CommonTapeImplementation (CommonTapeImplementation &&)=delete
 Do not allow move construction. Relevant use cases should be covered by swap.
 
 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.
 
 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 &&)=delete
 Do not allow move assignment. Relevant use cases should be covered by swap.
 
CommonTapeImplementationoperator= (CommonTapeImplementation const &)=delete
 Do not allow copy assignment.
 
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 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.
 
inlinevoid reset (bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Reset the tape to the initial state for a fresh recording.
 
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.
 
inlinevoid 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 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 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 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.
 
void evaluateForward (AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Perform a forward evaluation of a part of the tape. It has to hold start <= end.
 
void writeTape (std::unique_ptr< TapeWriterInterface< Type > > writer)
 For full-tape writers using a smart pointer.
 
void writeTape (std::unique_ptr< TapeWriterInterface< Type > > writer, Position const &start, Position const &end)
 For partial-tape writers using a smart pointer.
 
void writeTape (codi::TapeWriterInterface< Type > &writeToFileRef)
 For full-tape writers using a manually generated writers.
 
void writeTape (codi::TapeWriterInterface< Type > &writeToFileRef, Position const &start, Position const &end)
 For partial-tape writers using a manually generated writers.
 
void writeTape (std::unique_ptr< TapeWriterInterface< Type > > writer)
 For full-tape writers using a smart pointer.
 
void writeTape (std::unique_ptr< TapeWriterInterface< Type > > writer, Position const &start, Position const &end)
 For partial-tape writers using a smart pointer.
 
void writeTape (codi::TapeWriterInterface< Type > &writeToFileRef)
 For full-tape writers using a manually generated writers.
 
void writeTape (codi::TapeWriterInterface< Type > &writeToFileRef, Position const &start, Position const &end)
 For partial-tape writers using a manually generated writers.
 
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)
 
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.
 
Position getPosition () const
 Current position of the tape.
 
Position getZeroPosition () const
 Initial position of the tape.
 
inlinevoid resetTo (Position const &pos, bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Reset the tape to the provided position.
 
inlinevoid 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.
 
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.
 
inlineTemporaryMemory & getTemporaryMemory ()
 Temporary memory that can be used for dynamic data both during the evaluation and the recording.
 
inlineConfig::LowLevelFunctionToken registerLowLevelFunction (LowLevelFunctionEntry< Impl, Real, Identifier > const &entry)
 Register a low level function on the tape.
 
inlineTemporaryMemory & getTemporaryMemory ()
 Temporary memory that can be used for dynamic data both during the evaluation and the recording.
 
inlineConfig::LowLevelFunctionToken registerLowLevelFunction (LowLevelFunctionEntry< Impl, Real, Identifier > const &entry)
 Register a low level function on the tape.
 
- Public Member Functions inherited from codi::CustomAdjointVectorEvaluationTapeInterface< CommonTapeTypes< T_TapeTypes >::Position >
void evaluate (Position const &start, Position const &end, AdjointVector &&data)
 Perform a reverse evaluation for a part of the tape. It hast to hold start >= end.
 
void evaluateForward (Position const &start, Position const &end, AdjointVector &&data)
 
void clearCustomAdjoints (Position const &start, Position const &end, AdjointVector &&data)
 Clear all adjoint values, that is, set them to zero.
 
InternalAdjoints getInternalAdjoints ()
 Obtain a representation of the tape's internal adjoint vector that can be used as custom adjoints.
 
- Public Member Functions inherited from codi::ForwardEvaluationTapeInterface< CommonTapeTypes< T_TapeTypes >::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< CommonTapeTypes< T_TapeTypes >::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_TapeTypes::Real, T_TapeTypes::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.
 
VectorAccessInterface< Real, Identifier > * createVectorAccessCustomAdjoints (AdjointVector &&data)
 
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_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier >
Real registerExternalFunctionOutput (LhsExpressionInterface< Real, Gradient, Tape, Lhs > &value)
 
void pushExternalFunction (ExternalFunction< ExternalFunctionTapeInterface > const &extFunc)
 
- Public Member Functions inherited from codi::GradientAccessTapeInterface< T_TapeTypes::Gradient, T_TapeTypes::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.
 
Identifier getPassiveIndex () const
 Identifier for passive values. Usually 0.
 
Identifier getInvalidIndex () const
 Invalid identifier.
 
bool isIdentifierActive (Identifier const &index) const
 
IndexManagerInterface< Identifier > & getIndexManager ()
 Returns a reference to the Index Manager.
 
void deactivateValue (LhsExpressionInterface< Real, Gradient, Tape, Lhs > &value)
 
void initIdentifier (Real &value, Identifier &identifier)
 
void destroyIdentifier (Real &value, Identifier &identifier)
 Has to be called for each identifier, before it is deallocated.
 
void store (Lhs &lhs, Rhs const &rhs)
 Has to be called by an AD variable every time it is assigned.
 
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_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::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_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier, CommonTapeTypes< T_TapeTypes >::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 evaluateKeepState (Position const &start, Position const &end, AdjointVector &&data)
 
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.
 
void evaluateForwardKeepState (Position const &start, Position const &end, AdjointVector &&data)
 
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::ReadWriteTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier, CommonTapeTypes< T_TapeTypes >::Position >
void writeTape (WriterInterfaceUniquePtr writer)
 For full-tape writers using a smart pointer.
 
void writeTape (WriterInterfaceUniquePtr writer, Position const &start, Position const &end)
 For partial-tape writers using a smart pointer.
 
void writeTape (WriterInterface &writeToFileRef)
 For full-tape writers using a manually generated writers.
 
void writeTape (WriterInterface &writeToFileRef, Position const &start, Position const &end)
 For partial-tape writers using a manually generated writers.
 
void writeTape (WriterInterface *writer, Position const &start, Position const &end)
 For full or partial tapes using a pointer to the writer.
 
void createStatementManual (Real const &lhsValue, Identifier &lhsIndex, Config::ArgumentSize const &size, Real const *jacobians, Identifier const *rhsIdentifiers)
 
void createStatementManual (Identifier const &lhsIndex, Real const &lhsValue, Config::ArgumentSize const &nActiveValues, Identifier const *const rhsIdentifiers, Config::ArgumentSize const &nPassiveValues, Real const *const rhsPrimals, Config::ArgumentSize const &nConstants, Real const *const rhsConstant, EvalHandle const &evalHandle)
 
- Public Member Functions inherited from codi::ReverseTapeInterface< T_TapeTypes::Real, T_TapeTypes::Gradient, T_TapeTypes::Identifier >
void registerInput (LhsExpressionInterface< Real, Gradient, Tape, Lhs > &value)
 
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.
 
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.
 

Public Attributes

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

Static Public Attributes

static bool constexpr AllowJacobianOptimization = true
 See InternalStatementRecordingTapeInterface.
 
static bool constexpr HasPrimalValues = false
 See PrimalEvaluationTapeInterface.
 
static bool constexpr LinearIndexHandling
 See IdentifierInformationTapeInterface.
 
static bool constexpr RequiresPrimalRestore = false
 See PrimalEvaluationTapeInterface.
 
static bool constexpr LinearIndexHandling
 
static bool constexpr AllowJacobianOptimization
 If certain operations can be hidden from the tape.
 
static bool constexpr HasPrimalValues
 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<typename AdjointVector>
inlinestatic void incrementAdjoints (AdjointVector &adjointVector, AdjointVectorTraits::Gradient< AdjointVector > const &lhsAdjoint, Config::ArgumentSize const &numberOfArguments, size_t &curJacobianPos, Real const *const rhsJacobians, Identifier const *const rhsIdentifiers)
 Performs the AD reverse equation for a statement.
 
template<typename AdjointVector>
inlinestatic void incrementTangents (AdjointVector const &adjointVector, AdjointVectorTraits::Gradient< AdjointVector > &lhsAdjoint, Config::ArgumentSize const &numberOfArguments, size_t &curJacobianPos, Real const *const rhsJacobians, Identifier const *const rhsIdentifiers)
 Performs the AD forward equation for a statement.
 
inlineTapeValues internalGetTapeValues () const
 Adds data from all streams, the size of the adjoint vector and index manager data.
 
template<typename Lhs>
inlinevoid internalRegisterInput (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value, bool unusedIndex)
 Add a new input to the tape.
 
template<typename Rhs>
inlinevoid pushJacobians (ExpressionInterface< Real, Rhs > const &rhs)
 Push Jacobians and delayed Jacobians to the tape.
 
- 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 deleteLowLevelFunctionData (Position const &pos)
 Delete all external function data up to pos.
 
inlinevoid incrementManualPushCounter ()
 Increment the manual push counter. Check against the declared push goal.
 
inlinevoid incrementManualPushCounter ()
 Increment the manual push counter. Check against the declared push goal.
 
inlinevoid 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.
 
inlinevoid 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.
 
TapeValues internalGetTapeValues () const
 Create tape values.
 
void init (typename ImplTapeTypes::NestedData *nested)
 Initialize the base class.
 
void init (typename ImplTapeTypes::NestedData *nested)
 Initialize the base class.
 
inlinevoid 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.
 
inlinestatic 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.
 
inlinestatic void skipLowLevelFunction (bool forward, size_t &curLLFByteDataPos, char *dataPtr, size_t &curLLFTInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr)
 Skip the data for a low level function.
 
inlinevoid 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.
 
inlinestatic 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.
 
inlinestatic void skipLowLevelFunction (bool forward, size_t &curLLFByteDataPos, char *dataPtr, size_t &curLLFTInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr)
 Skip the data for a low level function.
 

Protected Attributes

Adjoints adjoints
 Evaluation vector for AD.
 
MemberStore< IndexManager, Impl, TapeTypes::IsStaticIndexHandler > indexManager
 Index manager.
 
JacobianData jacobianData
 Data stream for argument specific 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.
 
bool active
 Whether or not the tape is in recording mode.
 
TemporaryMemory allocator
 Allocator for temporary memory.
 
TemporaryMemory allocator
 Allocator for temporary memory.
 
LowLevelFunctionByteData llfByteData
 Byte data for low level functions.
 
LowLevelFunctionByteData llfByteData
 Byte data for low level functions.
 
LowLevelFunctionInfoData llfInfoData
 Token and size 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 manualPushCounter
 Count the pushes after storeManual, to identify the last push.
 
size_t manualPushGoal
 Store the number of expected pushes after a storeManual call.
 
size_t manualPushGoal
 Store the number of expected pushes after a storeManual call.
 
Identifier manualPushLhsIdentifier
 For storeManual, remember the identifier assigned to the lhs.
 
Identifier manualPushLhsIdentifier
 For storeManual, remember the identifier assigned to the lhs.
 
Real manualPushLhsValue
 For storeManual, remember the value assigned to the lhs.
 
Real manualPushLhsValue
 For storeManual, remember the value assigned to the lhs.
 
std::set< TapeParametersoptions
 All options.
 
std::set< TapeParametersoptions
 All options.
 

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 internalEvaluateReverse_EvalStatements (Args &&... args)
 Perform a reverse evaluation of the tape. Arguments are from the recursive eval methods of the DataInterface.
 
void pushStmtData (Identifier const &index, Config::ArgumentSize const &numberOfArguments)
 Add statement specific data to the data streams.
 

Additional Inherited Members

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 void skipLowLevelFunction (bool forward, size_t &curLLFByteDataPos, char *dataPtr, size_t &curLLFTInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr)
 Skip the data for a low level function.
 
- 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.
 
static std::vector< LowLevelFunctionEntry< Impl, Real, Identifier > > * lowLevelFunctionLookup
 Lookup table for low level function.
 

Detailed Description

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

Base class for all standard Jacobian tape implementations.

This class provides nearly a full implementation of the FullTapeInterface. There are just a few internal methods left which have 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_TapeTypeshas to implement JacobianTapeTypes.
T_ImplType of the final implementation.

Member Typedef Documentation

◆ TapeTypes

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

See JacobianBaseTape.

Member Function Documentation

◆ beginUseAdjointVector()

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

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

◆ clearAdjoints()

template<typename T_TapeTypes, typename T_Impl>
inlinevoid codi::JacobianBaseTape< 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.

◆ createStatementManual()

template<typename T_TapeTypes, typename T_Impl>
void codi::JacobianBaseTape< T_TapeTypes, T_Impl >::createStatementManual ( Real const & lhsValue,
Identifier & lhsIndex,
Config::ArgumentSize const & size,
Real const * jacobians,
Identifier const * rhsIdentifiers )
inline

Initialize the statement from a file. It is especially important that the lhsIndex is valid when using this method. This overload is used for Jacobian tapes.

◆ createVectorAccess()

template<typename T_TapeTypes, typename T_Impl>
VectorAccess< decltype(adjoints.data())> * codi::JacobianBaseTape< T_TapeTypes, T_Impl >::createVectorAccess ( )
inline

◆ createVectorAccessCustomAdjoints() [1/2]

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

See Adjoint vector access.

Template Parameters
AdjointVectorType that supports access with operator[]. See codi::CustomAdjointVectorEvaluationTapeInterface.
Specialization for pointers passed as lvalues. Ensures that the pointer is copied, not referenced.

◆ createVectorAccessCustomAdjoints() [2/2]

template<typename T_TapeTypes, typename T_Impl>
template<typename AdjointVector>
VectorAccess< AdjointVector > * codi::JacobianBaseTape< T_TapeTypes, T_Impl >::createVectorAccessCustomAdjoints ( AdjointVector && data)
inline

See Adjoint vector access.

Template Parameters
AdjointVectorType that supports access with operator[]. See codi::CustomAdjointVectorEvaluationTapeInterface.

◆ deleteAdjointVector()

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

Delete the adjoint vector. See Adjoint vector management.

◆ deleteVectorAccess()

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

◆ destroyIdentifier()

template<typename T_TapeTypes, typename T_Impl>
template<typename Real>
inlinevoid codi::JacobianBaseTape< 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::JacobianBaseTape< T_TapeTypes, T_Impl >::endUseAdjointVector ( )
inline

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

◆ evaluate() [1/3]

template<typename T_TapeTypes, typename T_Impl>
void codi::CommonTapeImplementation< T_TapeTypes, 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.

◆ evaluate() [2/3]

template<typename T_TapeTypes, typename T_Impl>
inlinevoid codi::JacobianBaseTape< 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.

◆ evaluate() [3/3]

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

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

Tape evaluation with a custom adjoint vector.

Template Parameters
AdjointVectorSee CustomAdjointVectorEvaluationTapeInterface documentation.

◆ evaluateForward() [1/3]

template<typename T_TapeTypes, typename T_Impl>
void codi::CommonTapeImplementation< T_TapeTypes, 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.

◆ evaluateForward() [2/3]

template<typename T_TapeTypes, typename T_Impl>
void codi::JacobianBaseTape< 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.

◆ evaluateForward() [3/3]

template<typename T_TapeTypes, typename T_Impl>
template<typename AdjointVector>
void codi::JacobianBaseTape< T_TapeTypes, T_Impl >::evaluateForward ( Position const & start,
Position const & end,
AdjointVector && data )
inline

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

Tape evaluation with a custom adjoint vector.

Template Parameters
AdjointVectorSee CustomAdjointVectorEvaluationTapeInterface documentation.

◆ evaluateForwardKeepState() [1/2]

template<typename T_TapeTypes, typename T_Impl>
void codi::JacobianBaseTape< 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.

◆ evaluateForwardKeepState() [2/2]

template<typename T_TapeTypes, typename T_Impl>
template<typename AdjointVector>
void codi::JacobianBaseTape< T_TapeTypes, T_Impl >::evaluateForwardKeepState ( Position const & start,
Position const & end,
AdjointVector && data )
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.

◆ evaluateKeepState() [1/2]

template<typename T_TapeTypes, typename T_Impl>
void codi::JacobianBaseTape< 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.

◆ evaluateKeepState() [2/2]

template<typename T_TapeTypes, typename T_Impl>
template<typename AdjointVector>
void codi::JacobianBaseTape< T_TapeTypes, T_Impl >::evaluateKeepState ( Position const & start,
Position const & end,
AdjointVector && data )
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.

◆ evaluatePrimal()

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

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

◆ getIndexManager()

template<typename T_TapeTypes, typename T_Impl>
IndexManager & codi::JacobianBaseTape< T_TapeTypes, T_Impl >::getIndexManager ( )
inline

Returns a reference to the Index Manager.

◆ getParameter()

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

◆ gradient() [1/2]

template<typename T_TapeTypes, typename T_Impl>
inlineGradient & codi::JacobianBaseTape< 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.

◆ gradient() [2/2]

template<typename T_TapeTypes, typename T_Impl>
inlineGradient const & codi::JacobianBaseTape< 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.

◆ initIdentifier()

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

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

◆ inlinedecltype()

template<typename T_TapeTypes, typename T_Impl>
codi::JacobianBaseTape< T_TapeTypes, T_Impl >::inlinedecltype ( adjoints. data())
inline

Obtain a representation of the tape's internal adjoint vector that can be used as custom adjoints.

To avoid that functionality has to be implemented both for custom, external and internal adjoints, this method provides access to the internal adjoints so that they can be used as if they were custom adjoints.

Warning: If you use this method, proceed with care. If internal adjoints are modified due to side effect of other methods, the object returned here might become invalid, or, conversely, modifications of the returned object other than reading/writing adjoints might interfere with the tape's management of internal adjoints.

Template Parameters
InternalAdjointsPlaceholder for the implementation-dependent return type.

◆ pushJacobianManual()

template<typename T_TapeTypes, typename T_Impl>
void codi::JacobianBaseTape< 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>
inlinevoid codi::JacobianBaseTape< 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::JacobianBaseTape< 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>
inlinevoid codi::JacobianBaseTape< 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.

◆ resizeAdjointVector()

template<typename T_TapeTypes, typename T_Impl>
void codi::JacobianBaseTape< 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::JacobianBaseTape< T_TapeTypes, T_Impl >::setParameter ( TapeParameters parameter,
size_t value )
inline

◆ store() [1/5]

template<typename T_TapeTypes, typename T_Impl>
template<typename Aggregated, typename Type, typename Lhs, typename Rhs>
inlinevoid codi::JacobianBaseTape< T_TapeTypes, T_Impl >::store ( AggregatedActiveType< Aggregated, Type, Lhs > & lhs,
AggregatedActiveType< Aggregated, Type, 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 of aggregated types.

◆ store() [2/5]

template<typename T_TapeTypes, typename T_Impl>
template<typename Aggregated, typename Type, typename Lhs, typename Rhs>
inlinevoid codi::JacobianBaseTape< T_TapeTypes, T_Impl >::store ( AggregatedActiveType< Aggregated, Type, Lhs > & lhs,
ExpressionInterface< Aggregated, 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.
Implementation for AggregatedActiveType.

◆ store() [3/5]

template<typename T_TapeTypes, typename T_Impl>
template<typename Lhs, typename Rhs>
inlinevoid codi::JacobianBaseTape< 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() [4/5]

template<typename T_TapeTypes, typename T_Impl>
template<typename Lhs, typename Rhs>
inlinevoid codi::JacobianBaseTape< 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() [5/5]

template<typename T_TapeTypes, typename T_Impl>
template<typename Lhs>
inlinevoid codi::JacobianBaseTape< 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::JacobianBaseTape< 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>
inlinevoid codi::JacobianBaseTape< T_TapeTypes, T_Impl >::swap ( Impl & other)
inline

Swap all data with an other tape.

◆ writeTape() [1/5]

template<typename T_TapeTypes, typename T_Impl>
void codi::CommonTapeImplementation< T_TapeTypes, T_Impl >::writeTape ( codi::TapeWriterInterface< Type > & writeToFileRef)
inline

For full-tape writers using a manually generated writers.

◆ writeTape() [2/5]

template<typename T_TapeTypes, typename T_Impl>
void codi::CommonTapeImplementation< T_TapeTypes, T_Impl >::writeTape ( codi::TapeWriterInterface< Type > & writeToFileRef,
Position const & start,
Position const & end )
inline

For partial-tape writers using a manually generated writers.

◆ writeTape() [3/5]

template<typename T_TapeTypes, typename T_Impl>
template<typename Type>
void codi::JacobianBaseTape< T_TapeTypes, T_Impl >::writeTape ( codi::TapeWriterInterface< Type > * writer,
Position const & start,
Position const & end )
inline

For full or partial tapes using a pointer to the writer.

◆ writeTape() [4/5]

template<typename T_TapeTypes, typename T_Impl>
void codi::CommonTapeImplementation< T_TapeTypes, T_Impl >::writeTape ( std::unique_ptr< TapeWriterInterface< Type > > writer)
inline

For full-tape writers using a smart pointer.

◆ writeTape() [5/5]

template<typename T_TapeTypes, typename T_Impl>
void codi::CommonTapeImplementation< T_TapeTypes, T_Impl >::writeTape ( std::unique_ptr< TapeWriterInterface< Type > > writer,
Position const & start,
Position const & end )
inline

For partial-tape writers using a smart pointer.

Member Data Documentation

◆ LinearIndexHandling

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

See IdentifierInformationTapeInterface.


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