38#include "../expressions/lhsExpressionInterface.hpp"
39#include "../expressions/logic/helpers/jacobianComputationLogic.hpp"
41#include "../traits/expressionTraits.hpp"
42#include "../traits/realTraits.hpp"
43#include "../traits/tapeTraits.hpp"
44#include "interfaces/gradientAccessTapeInterface.hpp"
45#include "interfaces/internalStatementRecordingTapeInterface.hpp"
70 template<
typename T_Real,
typename T_Gradient>
88 template<
typename Real>
95 template<
typename Real>
106 template<
typename Node>
119 template<
typename Lhs,
typename Rhs>
122 LocalReverseLogic reversal;
125 reversal.eval(rhs.
cast(), 1.0, newGradient);
127 lhs.
cast().value() = rhs.
cast().getValue();
128 lhs.
cast().gradient() = newGradient;
133 template<
typename Lhs,
typename Rhs>
136 lhs.
cast().value() = rhs.
cast().getValue();
137 lhs.
cast().gradient() = rhs.
cast().getGradient();
142 template<
typename Lhs>
144 lhs.
cast().value() = rhs;
206 template<
typename T_Type>
223 template<
typename T_Type>
230 using Real =
typename Type::Real;
235 return Real() == v.getValue() &&
typename Type::Gradient() == v.getGradient();
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:457
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:94
#define CODI_ENABLE_CHECK(option, condition)
Definition macros.hpp:53
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:111
bool constexpr IgnoreInvalidJacobians
Ignore invalid Jacobians like NaN or Inf.
Definition config.h:240
typename TraitsImplementation< Type >::Real Real
Inner type of the real value.
Definition realTraits.hpp:113
bool isTotalFinite(Type const &v)
Function for checking if all values of the type are finite.
Definition realTraits.hpp:133
typename TraitsImplementation< Type >::PassiveReal PassiveReal
The original computation type, that was used in the application.
Definition realTraits.hpp:117
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
void CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:46
AdjointsManagement
Policies for management of the tape's interal adjoints.
Definition tapeParameters.hpp:98
@ Automatic
Manage internal adjoints automatically, including locking, bounds checking, and resizing.
Represents a concrete lvalue in the CoDiPack expression tree.
Definition activeType.hpp:52
Base class for all CoDiPack expressions.
Definition expressionInterface.hpp:59
Impl const & cast() const
Cast to the implementation.
Definition expressionInterface.hpp:75
Implementation of a tape-free forward AD mode through the internal expression interfaces.
Definition forwardEvaluation.hpp:72
T_Gradient Gradient
See ForwardEvaluation.
Definition forwardEvaluation.hpp:76
RealTraits::PassiveReal< Real > PassiveReal
Basic computation type.
Definition forwardEvaluation.hpp:78
void store(LhsExpressionInterface< Real, Gradient, ForwardEvaluation, Lhs > &lhs, LhsExpressionInterface< Real, Gradient, ForwardEvaluation, Rhs > const &rhs)
Has to be called by an AD variable every time it is assigned.
Definition forwardEvaluation.hpp:134
void store(LhsExpressionInterface< Real, Gradient, ForwardEvaluation, Lhs > &lhs, Real const &rhs)
Has to be called by an AD variable every time it is assigned.
Definition forwardEvaluation.hpp:143
void setGradient(Identifier &identifier, Gradient const &gradient, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Set the gradient.
Definition forwardEvaluation.hpp:156
void destroyIdentifier(Real &value, Identifier &identifier)
Has to be called for each identifier, before it is deallocated.
Definition forwardEvaluation.hpp:96
T_Real Real
See ForwardEvaluation.
Definition forwardEvaluation.hpp:75
void store(LhsExpressionInterface< Real, Gradient, ForwardEvaluation, Lhs > &lhs, ExpressionInterface< Real, Rhs > const &rhs)
Has to be called by an AD variable every time it is assigned.
Definition forwardEvaluation.hpp:120
Gradient const & getGradient(Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const
Set the gradient.
Definition forwardEvaluation.hpp:165
static bool constexpr AllowJacobianOptimization
See InternalStatementRecordingTapeInterface.
Definition forwardEvaluation.hpp:85
void initIdentifier(Real &value, Identifier &identifier)
Definition forwardEvaluation.hpp:89
Gradient & gradient(Identifier &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Reference access to gradient.
Definition forwardEvaluation.hpp:174
Gradient const & gradient(Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const
Constant reference access to gradient.
Definition forwardEvaluation.hpp:183
Gradient Identifier
Same as the gradient type. Tangent data is stored in the active types.
Definition forwardEvaluation.hpp:79
Allow for a direct access to the gradient information computed by the tape.
Definition gradientAccessTapeInterface.hpp:67
Internal tape interface that is used by active types to trigger the storing of an expression.
Definition internalStatementRecordingTapeInterface.hpp:65
Definition jacobianComputationLogic.hpp:53
void link(Child const &child, Root const &root, Jacobian const &jacobian, Args &&... args)
Definition jacobianComputationLogic.hpp:84
Base class for all CoDiPack lvalue expression.
Definition lhsExpressionInterface.hpp:63
Impl & cast()
Cast to the implementation.
Definition lhsExpressionInterface.hpp:99
T_Type Type
See RealTraits::IsTotalFinite.
Definition forwardEvaluation.hpp:210
static bool isTotalFinite(Type const &v)
Checks if the values are all finite.
Definition forwardEvaluation.hpp:215
Function for checking if all values of the type are finite.
Definition realTraits.hpp:82
static bool isTotalZero(Type const &v)
Checks if the values are completely zero.
Definition forwardEvaluation.hpp:234
T_Type Type
See RealTraits::IsTotalZero.
Definition forwardEvaluation.hpp:227
typename Type::Real Real
Definition forwardEvaluation.hpp:230
Function for checking if the value of the type is completely zero.
Definition realTraits.hpp:100
void node(Node const &node, Args &&... args)
Called for each node in the expression.
Definition traversalLogic.hpp:86