CoDiPack  3.0.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
primalValueReuseTape.hpp
1/*
2 * CoDiPack, a Code Differentiation Package
3 *
4 * Copyright (C) 2015-2025 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://scicomp.rptu.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum, Johannes Blühdorn (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of CoDiPack (http://scicomp.rptu.de/software/codi).
11 *
12 * CoDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * CoDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty
19 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU General Public License for more details.
22 * You should have received a copy of the GNU
23 * General Public License along with CoDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * For other licensing options please contact us.
27 *
28 * Authors:
29 * - SciComp, University of Kaiserslautern-Landau:
30 * - Max Sagebaum
31 * - Johannes Blühdorn
32 * - Former members:
33 * - Tim Albring
34 */
35#pragma once
36
37#include <algorithm>
38#include <functional>
39#include <type_traits>
40
41#include "../config.h"
42#include "../expressions/lhsExpressionInterface.hpp"
43#include "../expressions/logic/compileTimeTraversalLogic.hpp"
44#include "../expressions/logic/constructStaticContext.hpp"
45#include "../expressions/logic/traversalLogic.hpp"
46#include "../misc/macros.hpp"
47#include "../misc/memberStore.hpp"
48#include "../traits/expressionTraits.hpp"
49#include "data/chunk.hpp"
50#include "indices/indexManagerInterface.hpp"
51#include "primalValueBaseTape.hpp"
52
54namespace codi {
55
63 template<typename T_TapeTypes>
64 struct PrimalValueReuseTape : public PrimalValueBaseTape<T_TapeTypes, PrimalValueReuseTape<T_TapeTypes>> {
65 public:
66
67 using TapeTypes =
68 CODI_DD(T_TapeTypes,
71
73 friend Base;
74
75 using Real = typename TapeTypes::Real;
76 using Gradient = typename TapeTypes::Gradient;
77 using Identifier = typename TapeTypes::Identifier;
79 using StatementEvaluator = typename TapeTypes::StatementEvaluator;
80 using EvalHandle = typename TapeTypes::EvalHandle;
81 using Position = typename Base::Position;
82
83 using StatementData = typename TapeTypes::StatementData;
84
85 using StatementDataPointers = typename Base::StatementDataPointers;
86
87 template<typename T>
88 using StackArray = typename Base::template StackArray<T>;
89
92
94
95 private:
96
97 CODI_INLINE static void internalClearAdjoints_EvalStatements(
98 /* data from call */
99 ADJOINT_VECTOR_TYPE* adjointVector,
100 /* data from low level function byte data vector */
101 size_t& curLLFByteDataPos, size_t const& endLLFByteDataPos, char* dataPtr,
102 /* data from low level function info data vector */
103 size_t& curLLFInfoDataPos, size_t const& endLLFInfoDataPos, Config::LowLevelFunctionToken* const tokenPtr,
104 Config::LowLevelFunctionDataSize* const dataSizePtr,
105 /* data from statementByteData */
106 size_t& curStatementBytePos, size_t const& endStatementBytePos, char* stmtDataPtr,
107 /* data from statementData */
108 size_t& curStatementPos, size_t const& endStatementPos,
109 Config::ArgumentSize const* const numberOfPassiveArguments, EvalHandle const* const stmtEvalHandle,
110 Config::LowLevelFunctionDataSize* const stmtByteSize) {
111 CODI_UNUSED(endLLFByteDataPos, endLLFInfoDataPos, endStatementBytePos);
112
113 while (curStatementPos < endStatementPos) CODI_Likely {
114 Config::ArgumentSize nPassiveValues = numberOfPassiveArguments[curStatementPos];
115
117 Base::skipLowLevelFunction(true, curLLFByteDataPos, dataPtr, curLLFInfoDataPos, tokenPtr, dataSizePtr);
118 } else CODI_Likely {
119 StatementEvaluator::template call<StatementCall::ClearAdjoints, PrimalValueReuseTape>(
120 stmtEvalHandle[curStatementPos], adjointVector, nPassiveValues, &stmtDataPtr[curStatementBytePos]);
121
122 curStatementBytePos += stmtByteSize[curStatementPos];
123 }
124
125 curStatementPos += 1;
126 }
127 }
128
129 public:
130
134 void clearAdjoints(Position const& start, Position const& end,
136 CODI_UNUSED(adjointsManagement);
137
138 clearCustomAdjoints(start, end, this->adjoints.data());
139 }
140
142 template<typename AdjointVector>
143 void clearCustomAdjoints(Position const& start, Position const& end, AdjointVector data) {
146 CODI_T(std::is_same<typename std::remove_reference<AdjointVector>::type, Gradient*>::value),
147 "Please enable 'CODI_VariableAdjointInterfaceInPrimalTapes' in order"
148 " to use custom adjoint vectors in the primal value tapes.");
149
150 typename Base::template VectorAccess<AdjointVector> vectorAccess(data, this->primals.data());
151
152 ADJOINT_VECTOR_TYPE* dataVector = Base::template selectAdjointVector<AdjointVector>(&vectorAccess, data);
153
154 this->llfByteData.evaluateForward(end, start, internalClearAdjoints_EvalStatements, dataVector);
155 }
156
157 protected:
158
161 /* data from call */
162 PrimalValueReuseTape& tape, Real* primalVector, ADJOINT_VECTOR_TYPE* adjointVector,
163 /* data from low level function byte data vector */
164 size_t& curLLFByteDataPos, size_t const& endLLFByteDataPos, char* dataPtr,
165 /* data from low level function info data vector */
166 size_t& curLLFInfoDataPos, size_t const& endLLFInfoDataPos, Config::LowLevelFunctionToken* const tokenPtr,
167 Config::LowLevelFunctionDataSize* const dataSizePtr,
168 /* data from statementByteData */
169 size_t& curStatementBytePos, size_t const& endStatementBytePos, char* stmtDataPtr,
170 /* data from statementData */
171 size_t& curStatementPos, size_t const& endStatementPos,
172 Config::ArgumentSize const* const numberOfPassiveArguments, EvalHandle const* const stmtEvalHandle,
173 Config::LowLevelFunctionDataSize* const stmtByteSize) {
174 CODI_UNUSED(endLLFByteDataPos, endLLFInfoDataPos, endStatementBytePos);
175
176#if !CODI_VariableAdjointInterfaceInPrimalTapes
177 typename Base::template VectorAccess<Gradient*> vectorAccess(adjointVector, primalVector);
178#endif
179
180 size_t linearAdjointPos = 0; // Not accessd by the implementation, just a temporary.
181 StackArray<Real> lhsPrimals = {};
182 StackArray<Gradient> lhsTangents = {};
183
184 while (curStatementPos < endStatementPos) CODI_Likely {
185 Config::ArgumentSize nPassiveValues = numberOfPassiveArguments[curStatementPos];
186
189 tape, true, curLLFByteDataPos, dataPtr, curLLFInfoDataPos, tokenPtr, dataSizePtr,
191 adjointVector
192#else
193 &vectorAccess
194#endif
195 );
196 } else CODI_Likely {
197 StatementEvaluator::template call<StatementCall::Forward, PrimalValueReuseTape>(
198 stmtEvalHandle[curStatementPos], tape, lhsPrimals.data(), lhsTangents.data(), primalVector,
199 adjointVector, linearAdjointPos, nPassiveValues, &stmtDataPtr[curStatementBytePos]);
200
201 curStatementBytePos += stmtByteSize[curStatementPos];
202 }
203
204 curStatementPos += 1;
205 }
206 }
207
210 /* data from call */
211 PrimalValueReuseTape& tape, Real* primalVector,
212 /* data from low level function byte data vector */
213 size_t& curLLFByteDataPos, size_t const& endLLFByteDataPos, char* dataPtr,
214 /* data from low level function info data vector */
215 size_t& curLLFInfoDataPos, size_t const& endLLFInfoDataPos, Config::LowLevelFunctionToken* const tokenPtr,
216 Config::LowLevelFunctionDataSize* const dataSizePtr,
217 /* data from statementByteData */
218 size_t& curStatementBytePos, size_t const& endStatementBytePos, char* stmtDataPtr,
219 /* data from statementData */
220 size_t& curStatementPos, size_t const& endStatementPos,
221 Config::ArgumentSize const* const numberOfPassiveArguments, EvalHandle const* const stmtEvalHandle,
222 Config::LowLevelFunctionDataSize* const stmtByteSize) {
223 CODI_UNUSED(endLLFByteDataPos, endLLFInfoDataPos, endStatementBytePos);
224
225 typename Base::template VectorAccess<Gradient*> vectorAccess(nullptr, primalVector);
226 StackArray<Real> lhsPrimals = {};
227
228 size_t linearAdjointPos = 0; // Not accessd by the implementation, just a temporary.
229
230 while (curStatementPos < endStatementPos) CODI_Likely {
231 Config::ArgumentSize nPassiveValues = numberOfPassiveArguments[curStatementPos];
232
235 tape, true, curLLFByteDataPos, dataPtr, curLLFInfoDataPos, tokenPtr, dataSizePtr, &vectorAccess);
236 } else CODI_Likely {
237 StatementEvaluator::template call<StatementCall::Primal, PrimalValueReuseTape>(
238 stmtEvalHandle[curStatementPos], tape, lhsPrimals.data(), primalVector, linearAdjointPos,
239 numberOfPassiveArguments[curStatementPos], &stmtDataPtr[curStatementBytePos]);
240
241 curStatementBytePos += stmtByteSize[curStatementPos];
242 }
243
244 curStatementPos += 1;
245 }
246 }
247
250 /* data from call */
251 PrimalValueReuseTape& tape, Real* primalVector, ADJOINT_VECTOR_TYPE* adjointVector,
252 /* data from low level function byte data vector */
253 size_t& curLLFByteDataPos, size_t const& endLLFByteDataPos, char* dataPtr,
254 /* data from low level function info data vector */
255 size_t& curLLFInfoDataPos, size_t const& endLLFInfoDataPos, Config::LowLevelFunctionToken* const tokenPtr,
256 Config::LowLevelFunctionDataSize* const dataSizePtr,
257 /* data from statementByteData */
258 size_t& curStatementBytePos, size_t const& endStatementBytePos, char* stmtDataPtr,
259 /* data from statementData */
260 size_t& curStatementPos, size_t const& endStatementPos,
261 Config::ArgumentSize const* const numberOfPassiveArguments, EvalHandle const* const stmtEvalHandle,
262 Config::LowLevelFunctionDataSize* const stmtByteSize) {
263 CODI_UNUSED(endLLFByteDataPos, endLLFInfoDataPos, endStatementBytePos);
264
265#if !CODI_VariableAdjointInterfaceInPrimalTapes
266 typename Base::template VectorAccess<Gradient*> vectorAccess(adjointVector, primalVector);
267#endif
268
269 size_t linearAdjointPos = 0; // Not accessd by the implementation, just a temporary.
270 StackArray<Gradient> lhsAdjoints = {};
271
272 while (curStatementPos > endStatementPos) CODI_Likely {
273 curStatementPos -= 1;
274
275 Config::ArgumentSize nPassiveValues = numberOfPassiveArguments[curStatementPos];
276
279 tape, false, curLLFByteDataPos, dataPtr, curLLFInfoDataPos, tokenPtr, dataSizePtr,
281 adjointVector
282#else
283 &vectorAccess
284#endif
285 );
286 } else CODI_Likely {
287 curStatementBytePos -= stmtByteSize[curStatementPos];
288
289 StatementEvaluator::template call<StatementCall::Reverse, PrimalValueReuseTape>(
290 stmtEvalHandle[curStatementPos], tape, lhsAdjoints.data(), primalVector, adjointVector,
291 linearAdjointPos, numberOfPassiveArguments[curStatementPos], &stmtDataPtr[curStatementBytePos]);
292 }
293 }
294 }
295
297 template<typename TapeTypes>
299 /* data from call */
300 Real* primalVector,
301 /* file interface pointer*/
303 /* data from low level function byte data vector */
304 size_t& curLLFByteDataPos, size_t const& endLLFByteDataPos, char* dataPtr,
305 /* data from low level function info data vector */
306 size_t& curLLFInfoDataPos, size_t const& endLLFInfoDataPos, Config::LowLevelFunctionToken* const tokenPtr,
307 Config::LowLevelFunctionDataSize* const dataSizePtr,
308 /* data from statementByteData */
309 size_t& curStatementBytePos, size_t const& endStatementBytePos, char* stmtDataPtr,
310 /* data from statementData */
311 size_t& curStatementPos, size_t const& endStatementPos,
312 Config::ArgumentSize const* const numberOfPassiveArguments, EvalHandle const* const stmtEvalHandle,
313 Config::LowLevelFunctionDataSize* const stmtByteSize) {
314 CODI_UNUSED(endLLFByteDataPos, endLLFInfoDataPos, endStatementBytePos);
315
316 while (curStatementPos < endStatementPos) {
317 Config::ArgumentSize nPassiveValues = numberOfPassiveArguments[curStatementPos];
318
320 writer->writeLowLevelFunction(curLLFByteDataPos, dataPtr, curLLFInfoDataPos, tokenPtr, dataSizePtr);
321 } else CODI_Likely {
322 WriteInfo writeInfo;
323 StatementEvaluator::template call<StatementCall::WriteInformation, PrimalValueReuseTape>(
324 stmtEvalHandle[curStatementPos], writeInfo, primalVector, nPassiveValues,
325 &stmtDataPtr[curStatementBytePos]);
326
327 StatementDataPointers pointers = {};
328 pointers.populate(writeInfo.numberOfOutputArguments, writeInfo.numberOfActiveArguments, nPassiveValues,
329 writeInfo.numberOfConstantArguments, &stmtDataPtr[curStatementBytePos]);
330
331 writer->writeStatement(writeInfo, pointers.lhsIdentifiers, pointers.oldLhsValues, nPassiveValues,
332 pointers.rhsIdentifiers, pointers.passiveValues, pointers.constantValues,
333 stmtEvalHandle[curStatementPos]);
334
335 curStatementBytePos += stmtByteSize[curStatementPos];
336 }
337
338 curStatementPos += 1;
339 }
340 }
341
342 private:
343
344 CODI_INLINE static void internalResetPrimals_EvalStatements(
345 /* data from call */
346 Real* primalVector,
347 /* data from low level function byte data vector */
348 size_t& curLLFByteDataPos, size_t const& endLLFByteDataPos, char* dataPtr,
349 /* data from low level function info data vector */
350 size_t& curLLFInfoDataPos, size_t const& endLLFInfoDataPos, Config::LowLevelFunctionToken* const tokenPtr,
351 Config::LowLevelFunctionDataSize* const dataSizePtr,
352 /* data from statementByteData */
353 size_t& curStatementBytePos, size_t const& endStatementBytePos, char* stmtDataPtr,
354 /* data from statementData */
355 size_t& curStatementPos, size_t const& endStatementPos,
356 Config::ArgumentSize const* const numberOfPassiveArguments, EvalHandle const* const stmtEvalHandle,
357 Config::LowLevelFunctionDataSize* const stmtByteSize) {
358 CODI_UNUSED(endLLFByteDataPos, endLLFInfoDataPos, endStatementBytePos);
359
360 while (curStatementPos > endStatementPos) CODI_Likely {
361 curStatementPos -= 1;
362
363 Config::ArgumentSize nPassiveValues = numberOfPassiveArguments[curStatementPos];
364
366 Base::skipLowLevelFunction(false, curLLFByteDataPos, dataPtr, curLLFInfoDataPos, tokenPtr, dataSizePtr);
367 } else CODI_Likely {
368 curStatementBytePos -= stmtByteSize[curStatementPos];
369
370 StatementEvaluator::template call<StatementCall::ResetPrimals, PrimalValueReuseTape>(
371 stmtEvalHandle[curStatementPos], primalVector, nPassiveValues, &stmtDataPtr[curStatementBytePos]);
372 }
373 }
374 }
375
376 public:
377
380 this->llfByteData.evaluateReverse(this->getPosition(), pos, internalResetPrimals_EvalStatements,
381 this->primals.data());
382 }
383
384 public:
386 void revertPrimals(Position const& pos) {
388 }
389 };
390}
#define CODI_Unlikely
Declare unlikely evaluation of an execution path.
Definition config.h:408
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:469
#define CODI_VariableAdjointInterfaceInPrimalTapes
See codi::Config::VariableAdjointInterfaceInPrimalTapes.
Definition config.h:278
#define ADJOINT_VECTOR_TYPE
See codi::Config::VariableAdjointInterfaceInPrimalTapes.
Definition config.h:286
#define CODI_Likely
Declare likely evaluation of an execution path.
Definition config.h:406
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:96
#define CODI_STATIC_ASSERT(cond, message)
Static assert definition for CoDiPack. Not evaluated in IDE mode.
Definition macros.hpp:129
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:116
uint16_t LowLevelFunctionDataSize
Size store type for a low level function.
Definition config.h:98
uint16_t LowLevelFunctionToken
Token type for low level functions in the tapes.
Definition config.h:108
size_t constexpr StatementLowLevelFunctionTag
Statement tag for low level functions.
Definition config.h:126
bool constexpr VariableAdjointInterfaceInPrimalTapes
Allow custom adjoint vector in primal values tapes.
Definition config.h:281
uint8_t ArgumentSize
Type for the number of arguments in statements.
Definition config.h:117
typename TraitsImplementation< Type >::PassiveReal PassiveReal
The original computation type that was used in the application.
Definition realTraits.hpp:123
CoDiPack - Code Differentiation Package.
Definition codi.hpp:94
inlinevoid CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:54
AdjointsManagement
Policies for management of the tape's interal adjoints.
Definition tapeParameters.hpp:100
@ Automatic
Manage internal adjoints automatically, including locking, bounds checking, and resizing.
Definition tapeParameters.hpp:102
ChunkedData< Chunk, NestedData > DefaultChunkedData
ChunkData DataInterface used in all regular tapes.
Definition chunkedData.hpp:520
Position getPosition() const
Current position of the tape.
Definition commonTapeImplementation.hpp:684
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.
Definition commonTapeImplementation.hpp:552
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 bee...
Definition commonTapeImplementation.hpp:517
LowLevelFunctionByteData llfByteData
Byte data for low level functions.
Definition commonTapeImplementation.hpp:156
Indices enable the mapping of primal values to their adjoint counterparts.
Definition indexManagerInterface.hpp:78
Gradient * selectAdjointVector(VectorAccess< AdjointVector > *vectorAccess, AdjointVector data)
Definition primalValueBaseTape.hpp:773
std::vector< Real > primals
Definition primalValueBaseTape.hpp:184
std::vector< Gradient > adjoints
Definition primalValueBaseTape.hpp:183
inlinevoid clearAdjoints(AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Definition primalValueBaseTape.hpp:705
typename Base::Position Position
Definition primalValueBaseTape.hpp:158
PrimalAdjointVectorAccess< Real, Identifier, AdjointVector > VectorAccess
Definition primalValueBaseTape.hpp:162
inlinestatic void internalEvaluateForward_EvalStatements(PrimalValueReuseTape &tape, Real *primalVector, Gradient *adjointVector, size_t &curLLFByteDataPos, size_t const &endLLFByteDataPos, char *dataPtr, size_t &curLLFInfoDataPos, size_t const &endLLFInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr, size_t &curStatementBytePos, size_t const &endStatementBytePos, char *stmtDataPtr, size_t &curStatementPos, size_t const &endStatementPos, Config::ArgumentSize const *const numberOfPassiveArguments, EvalHandle const *const stmtEvalHandle, Config::LowLevelFunctionDataSize *const stmtByteSize)
Perform a forward evaluation of the tape. Arguments are from the recursive eval methods of the DataIn...
Definition primalValueReuseTape.hpp:160
inlinestatic void internalWriteTape(Real *primalVector, codi::TapeWriterInterface< TapeTypes > *writer, size_t &curLLFByteDataPos, size_t const &endLLFByteDataPos, char *dataPtr, size_t &curLLFInfoDataPos, size_t const &endLLFInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr, size_t &curStatementBytePos, size_t const &endStatementBytePos, char *stmtDataPtr, size_t &curStatementPos, size_t const &endStatementPos, Config::ArgumentSize const *const numberOfPassiveArguments, EvalHandle const *const stmtEvalHandle, Config::LowLevelFunctionDataSize *const stmtByteSize)
Passes the statement information and the stmtEvalHandle to the writer.
Definition primalValueReuseTape.hpp:298
inlinevoid internalResetPrimalValues(Position const &pos)
Reset the primal values to the given position.
Definition primalValueReuseTape.hpp:379
typename TapeTypes::Real Real
See TapeTypesInterface.
Definition primalValueReuseTape.hpp:75
typename TapeTypes::Gradient Gradient
See TapeTypesInterface.
Definition primalValueReuseTape.hpp:76
typename TapeTypes::StatementData StatementData
See PrimalValueTapeTypes.
Definition primalValueReuseTape.hpp:83
typename Base::StatementDataPointers StatementDataPointers
Defined in PrimalValueBaseTape.
Definition primalValueReuseTape.hpp:85
inlinestatic void internalEvaluateReverse_EvalStatements(PrimalValueReuseTape &tape, Real *primalVector, Gradient *adjointVector, size_t &curLLFByteDataPos, size_t const &endLLFByteDataPos, char *dataPtr, size_t &curLLFInfoDataPos, size_t const &endLLFInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr, size_t &curStatementBytePos, size_t const &endStatementBytePos, char *stmtDataPtr, size_t &curStatementPos, size_t const &endStatementPos, Config::ArgumentSize const *const numberOfPassiveArguments, EvalHandle const *const stmtEvalHandle, Config::LowLevelFunctionDataSize *const stmtByteSize)
Perform a reverse evaluation of the tape. Arguments are from the recursive eval methods of the DataIn...
Definition primalValueReuseTape.hpp:249
typename Base::template StackArray< T > StackArray
See PrimalValueBaseTape.
Definition primalValueReuseTape.hpp:88
void revertPrimals(Position const &pos)
Revert the primals to the state indicated by pos.
Definition primalValueReuseTape.hpp:386
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 >= ...
Definition primalValueReuseTape.hpp:134
T_TapeTypes TapeTypes
See PrimalValueReuseTape.
Definition primalValueReuseTape.hpp:67
void clearCustomAdjoints(Position const &start, Position const &end, AdjointVector data)
Clear all adjoint values, that is, set them to zero.
Definition primalValueReuseTape.hpp:143
typename TapeTypes::Identifier Identifier
See TapeTypesInterface.
Definition primalValueReuseTape.hpp:77
typename TapeTypes::StatementEvaluator StatementEvaluator
See PrimalValueTapeTypes.
Definition primalValueReuseTape.hpp:79
typename Base::Position Position
See TapeTypesInterface.
Definition primalValueReuseTape.hpp:81
RealTraits::PassiveReal< Real > PassiveReal
Basic computation type.
Definition primalValueReuseTape.hpp:78
typename TapeTypes::EvalHandle EvalHandle
See PrimalValueTapeTypes.
Definition primalValueReuseTape.hpp:80
PrimalValueBaseTape< T_TapeTypes, PrimalValueReuseTape< T_TapeTypes > > Base
Base class abbreviation.
Definition primalValueReuseTape.hpp:72
PrimalValueReuseTape()
Constructor.
Definition primalValueReuseTape.hpp:91
inlinestatic void internalEvaluatePrimal_EvalStatements(PrimalValueReuseTape &tape, Real *primalVector, size_t &curLLFByteDataPos, size_t const &endLLFByteDataPos, char *dataPtr, size_t &curLLFInfoDataPos, size_t const &endLLFInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr, size_t &curStatementBytePos, size_t const &endStatementBytePos, char *stmtDataPtr, size_t &curStatementPos, size_t const &endStatementPos, Config::ArgumentSize const *const numberOfPassiveArguments, EvalHandle const *const stmtEvalHandle, Config::LowLevelFunctionDataSize *const stmtByteSize)
Perform a primal evaluation of the tape. Arguments are from the recursive eval methods of the DataInt...
Definition primalValueReuseTape.hpp:209
Type definitions for the primal value tapes.
Definition primalValueBaseTape.hpp:81
Creation of handles for the evaluation of expressions in a context where the expression type is not a...
Definition statementEvaluatorInterface.hpp:103
The interface used by all the tape writers. The tape writers are used to generate text,...
Definition tapeReaderWriterInterface.hpp:129
virtual void writeLowLevelFunction(size_t &curLLFByteDataPos, char *dataPtr, size_t &curLLFInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr)
Used for statements that contain a low level function.
Definition tapeReaderWriterInterface.hpp:171
virtual void writeStatement(Identifier const &curLhsIdentifier, size_t &curJacobianPos, Real const *const rhsJacobians, Identifier const *const rhsIdentifiers, Config::ArgumentSize const &nJacobians)
Called for each statement. The method writes the current statement to the file. This overload is used...
Definition tapeReaderWriterInterface.hpp:152
This class is used during the writing process of a primal value tape. The WriteInfo is returned by St...
Definition tapeReaderWriterInterface.hpp:69
size_t numberOfActiveArguments
Number of active arguments.
Definition tapeReaderWriterInterface.hpp:71
size_t numberOfOutputArguments
Number of output arguments.
Definition tapeReaderWriterInterface.hpp:70
size_t numberOfConstantArguments
Number of constant arguments.
Definition tapeReaderWriterInterface.hpp:72