44#include "../expressions/aggregate/aggregatedActiveType.hpp"
45#include "../expressions/aggregate/arrayAccessExpression.hpp"
46#include "../expressions/lhsExpressionInterface.hpp"
47#include "../expressions/logic/compileTimeTraversalLogic.hpp"
48#include "../expressions/logic/constructStaticContext.hpp"
49#include "../expressions/logic/helpers/forEachLeafLogic.hpp"
50#include "../expressions/logic/helpers/jacobianComputationLogic.hpp"
51#include "../expressions/logic/helpers/mathStatementGenLogic.hpp"
52#include "../expressions/logic/traversalLogic.hpp"
53#include "../misc/demangleName.hpp"
55#include "../misc/mathUtility.hpp"
56#include "../misc/memberStore.hpp"
57#include "../traits/expressionTraits.hpp"
58#include "commonTapeImplementation.hpp"
59#include "data/chunk.hpp"
60#include "data/chunkedData.hpp"
61#include "indices/indexManagerInterface.hpp"
62#include "misc/assignStatement.hpp"
63#include "misc/primalAdjointVectorAccess.hpp"
64#include "statementEvaluators/statementEvaluatorInterface.hpp"
65#include "statementEvaluators/statementEvaluatorTapeInterface.hpp"
79 template<
typename T_Real,
typename T_Gradient,
typename T_IndexManager,
typename T_StatementEvaluator,
80 template<
typename,
typename>
class T_Data>
89 template<
typename Chunk,
typename Nested>
98 IndexManager::NeedsStaticStorage;
128 template<
typename T_TapeTypes,
typename T_Impl>
144 using Real =
typename TapeTypes::Real;
161 template<
typename Adjo
intVector>
167 TapeTypes::IsLinearIndexHandler;
169 !TapeTypes::IsLinearIndexHandler;
195 return static_cast<Impl const&
>(*this);
199 return static_cast<Impl&
>(*this);
209 template<
typename... Args>
213 template<
typename... Args>
217 template<
typename... Args>
236 checkPrimalSize(
true);
260 checkAdjointSize(identifier);
288 template<
typename Real>
292 identifier = IndexManager::InactiveIndex;
296 template<
typename Real>
300 indexManager.get().template freeIndex<Impl>(identifier);
326 char* curPos = byteData;
332 curPos +=
sizeof(
Identifier) * reserverLhsSize;
335 curPos +=
sizeof(
Real) * passiveSize;
338 curPos +=
sizeof(
Real) * reserverLhsSize;
348 size_t constantSize) {
351 return sizeof(
Identifier) * (rhsSize + reserverLhsSize) +
sizeof(
Real) * (passiveSize + reserverLhsSize) +
360 StatementDataPointers& pointers) {
362 pointers.push(pointers.lhsIdentifiers, index);
363 pointers.push(pointers.oldLhsValues, oldPrimalValue);
369 size_t passiveSize,
size_t constantSize,
370 StatementDataPointers& pointers) {
375 char* byteData =
nullptr;
379 pointers.populate(lhsSize, rhsSize, passiveSize, constantSize, byteData);
385 template<
typename Lhs,
typename Rhs>
387 StatementDataPointers& pointers) {
392 return reserveStmtDataManual(MaxOutputArgs, MaxActiveArgs, MaxActiveArgs - activeArguments, MaxConstantArgs,
401 template<
typename Node>
404 numberOfActiveArguments += 1;
414 template<
typename Node>
418 rhsIndex = curPassiveArgument;
420 curPassiveArgument += 1;
428 template<
typename Node>
430 size_t& curPassiveArgument) {
434 using ConversionOperator =
typename Node::template ConversionOperator<PassiveReal>;
436 typename Node::Real v =
node.getValue();
440 ConversionOperator::toDataStore(AggregatedTraits::template arrayAccess<i.value>(v)));
449 template<
typename Lhs,
typename RhsType,
typename Rhs>
451 StatementDataPointers& pointers) {
454 CountActiveArguments countActiveArguments;
455 PushIdentifierPassiveAndConstant pushStatement;
461 size_t activeArguments = 0;
462 countActiveArguments.eval(rhs.
cast(), activeArguments);
467 size_t passiveArguments = 0;
468 pushStatement.eval(rhs.
cast(), pointers, passiveArguments);
470 StatementEvaluator::template createHandle<Impl, Impl, Stmt>(), byteSize);
489 template<
typename Node,
typename Jacobian>
492 rhsIdentifiers[pos] =
node.getIdentifier();
493 jacobians[pos] = jacobianExpr;
504 template<
typename Aggregated,
typename Type,
typename Lhs,
typename Rhs>
508 int constexpr Elements = AggregatedTraits::Elements;
510 bool primalStored =
false;
511 StatementDataPointers pointers = {};
514 bool generatedNewIndex =
false;
516 generatedNewIndex |=
indexManager.get().template assignIndex<Impl>(lhs.
values[i.value].getIdentifier());
518 checkPrimalSize(generatedNewIndex);
520 Aggregated
real = rhs.
cast().getValue();
530 JacobianExtractionLogic getRhsIdentifiersAndJacobians;
531 std::array<Identifier, MaxActiveArgs> rhsIdentifiers;
532 std::array<Real, MaxActiveArgs> jacobians;
534 rhsIdentifiers.data(), jacobians.data());
537 cast(), lhsIdentifier, AggregatedTraits::template arrayAccess<i.value>(
real), MaxActiveArgs,
538 rhsIdentifiers.data(), jacobians.data());
541 lhs.
values[i.value].value() = AggregatedTraits::template arrayAccess<i.value>(
real);
542 primalEntry = lhs.
values[i.value].getValue();
549 Aggregated
real = rhs.
cast().getValue();
552 lhs.
values[i.value].value() = AggregatedTraits::template arrayAccess<i.value>(
real);
560 template<
typename Aggregated,
typename Type,
typename Lhs,
typename Rhs>
565 int constexpr Elements = AggregatedTraits::Elements;
574 rhs.
values[i.value].getIdentifier());
584 lhs.
values[i.value].value() = rhs.
values[i.value].getValue();
589 template<
typename Lhs,
typename Rhs>
592 bool primalStored =
false;
593 StatementDataPointers pointers = {};
596 bool generatedNewIndex =
indexManager.get().template assignIndex<Impl>(lhs.
cast().getIdentifier());
597 checkPrimalSize(generatedNewIndex);
602 primalEntry = rhs.
cast().getValue();
607 JacobianExtractionLogic getRhsIdentifiersAndJacobians;
608 std::array<Identifier, MaxActiveArgs> rhsIdentifiers;
609 std::array<Real, MaxActiveArgs> jacobians;
610 getRhsIdentifiersAndJacobians.eval(rhs.
cast(),
Real(1.0), rhsIdentifiers.data(), jacobians.data());
613 rhs.
cast().getValue(), MaxActiveArgs,
614 rhsIdentifiers.data(), jacobians.data());
624 lhs.
cast().value() = rhs.
cast().getValue();
629 template<
typename Lhs,
typename Rhs>
637 indexManager.get().template copyIndex<Impl>(lhs.
cast().getIdentifier(), rhs.
cast().getIdentifier());
643 lhs.
cast().value() = rhs.
cast().getValue();
648 template<
typename Lhs>
652 lhs.
cast().value() = rhs;
663 template<
typename Lhs>
666 if (TapeTypes::IsLinearIndexHandler) {
670 bool generatedNewIndex;
672 generatedNewIndex =
indexManager.get().template assignUnusedIndex<Impl>(value.
cast().getIdentifier());
674 generatedNewIndex =
indexManager.get().template assignIndex<Impl>(value.
cast().getIdentifier());
676 checkPrimalSize(generatedNewIndex);
679 if (TapeTypes::IsLinearIndexHandler) {
684 Real oldValue = primalEntry;
685 primalEntry = value.
cast().value();
696 template<
typename Lhs>
708 size_t maxSize = std::min((
size_t)
indexManager.get().getLargestCreatedIndex() + 1,
adjoints.size());
709 for (
size_t i = 0; i < maxSize; i += 1) {
734 if (TapeTypes::IsLinearIndexHandler) {
735 name =
"CoDi Tape Statistics ( PrimalValueLinearTape )";
737 name =
"CoDi Tape Statistics ( PrimalValueReuseTape )";
741 size_t nAdjoints =
indexManager.get().getLargestCreatedIndex();
742 double memoryAdjoints =
static_cast<double>(nAdjoints) *
static_cast<double>(
sizeof(
Gradient));
744 size_t nPrimals =
indexManager.get().getLargestCreatedIndex();
745 double memoryPrimals =
static_cast<double>(nPrimals) *
static_cast<double>(
sizeof(
Real));
749 values.
addDoubleEntry(
"Memory allocated", memoryAdjoints, TapeValues::LocalReductionOperation::Sum,
true,
true);
753 values.
addDoubleEntry(
"Memory allocated", memoryPrimals, TapeValues::LocalReductionOperation::Sum,
true,
true);
772 template<
typename Adjo
intVector>
776#if CODI_VariableAdjointInterfaceInPrimalTapes
780 "Please enable 'CODI_VariableAdjointInterfaceInPrimalTapes' in order"
781 " to use custom adjoint vectors in the primal value tapes.");
792 template<
typename Node>
798#if CODI_VariableAdjointInterfaceInPrimalTapes
799 adjointVector->updateTangentWithLhs(
node.getIdentifier(), jacobian);
801 lhsTangent += jacobian * adjointVector[
node.getIdentifier()];
811 template<
bool copyPrimal,
typename Adjo
intVector>
815 CODI_T(std::is_same<
typename std::remove_reference<AdjointVector>::type,
Gradient*>::value),
816 "Please enable 'CODI_VariableAdjointInterfaceInPrimalTapes' in order"
817 " to use custom adjoint vectors in the primal value tapes.");
832 cast(), start, end, &vectorAccess, EventHints::EvaluationKind::Forward, EventHints::Endpoint::Begin);
834 Wrap_internalEvaluateForward_EvalStatements evalFunc{};
835 Base::llfByteData.evaluateForward(start, end, evalFunc, cast(), primalData, dataVector);
838 EventHints::EvaluationKind::Forward, EventHints::Endpoint::End);
846 template<
typename Node>
852#if CODI_VariableAdjointInterfaceInPrimalTapes
853 adjointVector->updateAdjointWithLhs(
node.getIdentifier(), jacobian);
855 adjointVector[
node.getIdentifier()] += jacobian * lhsAdjoint;
865 template<
bool copyPrimal,
typename Adjo
intVector>
869 CODI_T(std::is_same<
typename std::remove_reference<AdjointVector>::type,
Gradient*>::value),
870 "Please enable 'CODI_VariableAdjointInterfaceInPrimalTapes' in order"
871 " to use custom adjoint vectors in the primal value tapes.");
885 cast(), start, end, &vectorAccess, EventHints::EvaluationKind::Reverse, EventHints::Endpoint::Begin);
887 Wrap_internalEvaluateReverse_EvalStatements evalFunc;
888 Base::llfByteData.evaluateReverse(start, end, evalFunc, cast(), primalData, dataVector);
891 EventHints::EvaluationKind::Reverse, EventHints::Endpoint::End);
902 template<
typename Adjo
intVector>
908 template<
typename Adjo
intVector>
934 checkPrimalSize(
true);
935 other.checkPrimalSize(
true);
945 checkAdjointSize(
indexManager.get().getLargestCreatedIndex());
987 CODI_EXCEPTION(
"Tried to set a get only option.");
1010 template<
typename Adjo
intVector>
1017 template<
typename Adjo
int>
1033 template<
typename Lhs>
1051 checkAdjointSize(
indexManager.get().getLargestCreatedIndex());
1056 cast().evaluateForward(start, end,
adjoints.data());
1068 cast().incrementManualPushCounter();
1095 StatementDataPointers pointers = {};
1101 indexManager.get().template assignIndex<Impl>(lhsIndex);
1103 statementData.pushData(size, PrimalValueBaseTape::jacobianExpressions[size], byteSize);
1106 primalEntry = lhsValue;
1108 cast().initializeManualPushData(lhsValue, lhsIndex, size);
1126 Impl& impl = cast();
1131 primals[lhsIndices[0]] = lhsValues[0];
1134 StatementDataPointers pointers = {};
1140 for (
size_t activeCount = 0; activeCount < nActiveValues; activeCount++) {
1141 pointers.rhsIdentifiers[activeCount] = rhsIdentifiers[activeCount];
1143 for (
size_t passiveCount = 0; passiveCount < nPassiveValues; passiveCount++) {
1144 cast().incrementManualPushCounter();
1145 pointers.passiveValues[passiveCount] = rhsPrimals[passiveCount];
1147 for (
size_t constantCount = 0; constantCount < nConstants; constantCount++) {
1148 pointers.constantValues[constantCount] = rhsConstant[constantCount];
1151 statementData.pushData(nPassiveValues, evalHandle, byteSize);
1154 pushLhsData(lhsIndices[i], lhsValues[i], pointers);
1156 if (TapeTypes::IsLinearIndexHandler) {
1157 primals[lhsIndices[i]] = lhsValues[i];
1169 template<
typename Type>
1172 Impl& impl = cast();
1173 writer->
start(impl);
1213 checkAdjointSize(
indexManager.get().getLargestCreatedIndex());
1226 cast().internalResetPrimalValues(pos);
1242 checkAdjointSize(
indexManager.get().getLargestCreatedIndex());
1251 template<
typename Adjo
intVector>
1255 if (!TapeTypes::IsLinearIndexHandler) {
1266 checkAdjointSize(
indexManager.get().getLargestCreatedIndex());
1275 template<
typename Adjo
intVector>
1277 if (!TapeTypes::IsLinearIndexHandler) {
1278 cast().internalResetPrimalValues(end);
1308 EventHints::EvaluationKind::Primal, EventHints::Endpoint::Begin);
1310 Wrap_internalEvaluatePrimal_EvalStatements evalFunc{};
1314 EventHints::EvaluationKind::Primal, EventHints::Endpoint::End);
1333 template<
typename Stmt,
typename GenImpl>
1336 using Lhs =
typename Stmt::Lhs;
1337 using Rhs =
typename Stmt::Rhs;
1344 template<
size_t pos>
1356 template<
typename... Args>
1362 GenImpl::evaluateFull(GenImpl::evaluateInner, MaxOutputArgs, MaxActiveArgs, MaxConstantArgs,
1363 std::forward<Args>(args)...);
1368 template<StatementCall type,
typename Stmt>
1372#define STMT_COMMON_ARGS Config::ArgumentSize numberOfPassiveArguments, char *CODI_RESTRICT byteData
1373#define STMT_COMMON_CALL numberOfPassiveArguments, byteData
1377 template<
typename Stmt>
1392 pointers.
populate(maxOutputArgs, maxActiveArgs, numberOfPassiveArguments, maxConstantArgs, byteData);
1403 writeInfo.numberOfOutputArguments = maxOutputArgs;
1404 writeInfo.numberOfActiveArguments = maxActiveArgs;
1405 writeInfo.numberOfConstantArguments = maxConstantArgs;
1411 writeInfo.stmtExpression =
"Impl, Impl, ";
1414 mathGen.
eval(staticRhs, writeInfo.mathRepresentation);
1418 template<
typename Func,
typename... Args>
1420 func(std::forward<Args>(args)...);
1432 template<
typename Stmt>
1444 template<
typename Func>
1452 pointers.
populate(maxOutputArgs, maxActiveArgs, numberOfPassiveArguments, maxConstantArgs, byteData);
1454 for (
size_t iLhs = 0; iLhs < maxOutputArgs; iLhs += 1) {
1458#if CODI_VariableAdjointInterfaceInPrimalTapes
1459 adjointVector->resetAdjointVec(lhsIdentifier);
1461 adjointVector[lhsIdentifier] =
Gradient();
1474 template<
typename Stmt>
1482 template<
size_t pos>
1496#if CODI_VariableAdjointInterfaceInPrimalTapes
1497 adjointVector->setActiveVariableForIndirectAccess(i.value);
1503 incrementForward.
eval(expr,
Real(1.0), lhsTangents[i.value], adjointVector);
1504 lhsPrimals[i.value] = expr.getValue();
1509 template<
typename Func>
1518 pointers.
populate(maxOutputArgs, maxActiveArgs, numberOfPassiveArguments, maxConstantArgs, byteData);
1524 evalInner(primalVector, adjointVector, lhsPrimals, lhsTangents, pointers.
constantValues,
1527 for (
size_t iLhs = 0; iLhs < maxOutputArgs; iLhs += 1) {
1530 linearAdjointPos += 1;
1531 lhsIdentifier = linearAdjointPos;
1537 pointers.
oldLhsValues[iLhs] = primalVector[lhsIdentifier];
1540 primalVector[lhsIdentifier] = lhsPrimals[iLhs];
1542#if CODI_VariableAdjointInterfaceInPrimalTapes
1543 adjointVector->setLhsTangent(lhsIdentifier);
1545 adjointVector->getAdjointVec(lhsIdentifier));
1547 adjointVector[lhsIdentifier] = lhsTangents[iLhs];
1552 primalVector[lhsIdentifier]);
1568 template<
typename Stmt>
1576 template<
size_t pos>
1588 lhsPrimals[i.value] = expr.getValue();
1593 template<
typename Func>
1600 pointers.
populate(maxOutputArgs, maxActiveArgs, numberOfPassiveArguments, maxConstantArgs, byteData);
1608 for (
size_t iLhs = 0; iLhs < maxOutputArgs; iLhs += 1) {
1611 linearAdjointPos += 1;
1612 lhsIdentifier = linearAdjointPos;
1618 pointers.
oldLhsValues[iLhs] = primalVector[lhsIdentifier];
1621 primalVector[lhsIdentifier] = lhsPrimals[iLhs];
1624 primalVector[lhsIdentifier]);
1638 template<
typename Stmt>
1646 template<
size_t pos>
1659#if CODI_VariableAdjointInterfaceInPrimalTapes
1660 adjointVector->setActiveVariableForIndirectAccess(i.value);
1663 incrementReverse.
eval(expr,
Real(1.0),
const_cast<Gradient const&
>(lhsAdjoints[i.value]), adjointVector);
1668 template<
typename Func>
1676 pointers.
populate(maxOutputArgs, maxActiveArgs, numberOfPassiveArguments, maxConstantArgs, byteData);
1679 linearAdjointPos -= maxOutputArgs;
1682 bool allZero =
true;
1683 for (
size_t iLhs = 0; iLhs < maxOutputArgs; iLhs += 1) {
1686 lhsIdentifier = linearAdjointPos + 1 + iLhs;
1691#if CODI_VariableAdjointInterfaceInPrimalTapes
1693 adjointVector->getAdjointVec(lhsIdentifier));
1694 adjointVector->setActiveVariableForIndirectAccess(iLhs);
1695 adjointVector->setLhsAdjoint(lhsIdentifier);
1696 allZero &= adjointVector->isLhsZero();
1698 lhsAdjoints[iLhs] = adjointVector[lhsIdentifier];
1701 adjointVector[lhsIdentifier] =
Gradient();
1706 primalVector[lhsIdentifier]);
1708 primalVector[lhsIdentifier] = pointers.
oldLhsValues[iLhs];
1726 Base::internalEvaluate(tape, lhsAdjoints, primalVector, adjointVector, linearAdjointPos, STMT_COMMON_CALL);
1732 template<
typename Stmt>
1744 template<
typename Func>
1752 pointers.
populate(maxOutputArgs, maxActiveArgs, numberOfPassiveArguments, maxConstantArgs, byteData);
1755 for (
size_t iLhs = 0; iLhs < maxOutputArgs; iLhs += 1) {
1758 primalVector[lhsIdentifier] = pointers.
oldLhsValues[iLhs];
1772 CODI_INLINE void checkAdjointSize(Identifier
const& identifier) {
1773 if (identifier >= (Identifier)
adjoints.size()) {
1774 resizeAdjointsVector();
1778 CODI_INLINE void checkPrimalSize(
bool generatedNewIndex) {
1780 resizePrimalVector();
1796 template<
size_t size>
1800 template<
size_t size>
1806 template<
size_t size>
1813 template<
typename T_TapeImpl,
size_t T_size>
1822 static size_t constexpr size = T_size;
1824 using Real =
typename TapeImpl::Real;
1834 template<
typename Rhs,
typename Impl>
1842 template<StatementCall type,
typename Stmt>
1846 template<
typename Stmt>
1857 template<
typename Func>
1859 size_t const& maxActiveArgs,
size_t const& maxConstantArgs,
1860 WriteInfo& writeInfo,
Real* primalVector, STMT_COMMON_ARGS) {
1861 CODI_UNUSED(func, primalVector, numberOfPassiveArguments, byteData);
1866 writeInfo.
stmtExpression =
"Impl, typename Impl::template JacobianStatementGenerator<" +
1867 std::to_string(
size) +
">, codi::JacobianExpression<" + std::to_string(
size) +
1875 Base::internalEvaluate(writeInfo, primalVector, STMT_COMMON_CALL);
1880 template<
typename Stmt>
1891 template<
typename Func>
1893 size_t const& maxActiveArgs,
size_t const& maxConstantArgs,
1898 pointers.populate(maxOutputArgs, maxActiveArgs, numberOfPassiveArguments, maxConstantArgs, byteData);
1903 Identifier lhsIdentifier = pointers.lhsIdentifiers[0];
1905#if CODI_VariableAdjointInterfaceInPrimalTapes
1906 adjointVector->resetAdjointVec(lhsIdentifier);
1908 adjointVector[lhsIdentifier] =
Gradient();
1914 Base::internalEvaluate(adjointVector, STMT_COMMON_CALL);
1919 template<
typename Stmt>
1923 CODI_EXCEPTION(
"Forward evaluation of jacobian statement not possible.");
1928 CODI_EXCEPTION(
"Forward evaluation of jacobian statement not possible.");
1933 template<
typename Stmt>
1937 CODI_EXCEPTION(
"Primal evaluation of jacobian statement not possible.");
1942 CODI_EXCEPTION(
"Primal evaluation of jacobian statement not possible.");
1947 template<
typename Stmt>
1959 evalJacobianReverse(adjointVector, lhsAdjoints[0], primalVector, rhsIdentifiers);
1965 CODI_UNUSED(primalVector, lhsAdjoints, numberOfPassiveArguments);
1968 pointers.populate(1,
size,
size, 0, byteData);
1972 lhsIdentifier = linearAdjointPos;
1974 lhsIdentifier = pointers.lhsIdentifiers[0];
1977#if CODI_VariableAdjointInterfaceInPrimalTapes
1980 adjointVector->getAdjointVec(lhsIdentifier));
1981 adjointVector->setLhsAdjoint(lhsIdentifier);
1983 Gradient const lhsAdjoint = adjointVector[lhsIdentifier];
1986 adjointVector[lhsIdentifier] =
Gradient();
1990 primalVector[lhsIdentifier]);
1992 primalVector[lhsIdentifier] = pointers.oldLhsValues[0];
1995 evalJacobianReverse(adjointVector, lhsAdjoint, pointers.passiveValues, pointers.rhsIdentifiers);
2000 template<
typename Stmt>
2011 template<
typename Func>
2013 size_t const& maxActiveArgs,
size_t const& maxConstantArgs,
2014 Real* primalVector, STMT_COMMON_ARGS) {
2015 CODI_UNUSED(evalInner, maxActiveArgs, maxConstantArgs, numberOfPassiveArguments);
2018 pointers.populate(1,
size,
size, 0, byteData);
2023 Identifier lhsIdentifier = pointers.lhsIdentifiers[0];
2024 primalVector[lhsIdentifier] = pointers.oldLhsValues[0];
2029 Base::internalEvaluate(primalVector, STMT_COMMON_CALL);
2036 static void evalJacobianReverse(
ADJOINT_VECTOR_TYPE* adjointVector, Gradient lhsAdjoint, Real
const*
const values,
2037 Identifier
const*
const rhsIdentifiers) {
2038#if CODI_VariableAdjointInterfaceInPrimalTapes
2040 bool const lhsZero = adjointVector->isLhsZero();
2046 for (
size_t pos = 0; pos <
size; pos += 1) {
2047 Real
const& jacobian = values[pos];
2048#if CODI_VariableAdjointInterfaceInPrimalTapes
2049 adjointVector->updateAdjointWithLhs(rhsIdentifiers[pos], jacobian);
2051 adjointVector[rhsIdentifiers[pos]] += jacobian * lhsAdjoint;
2058#undef STMT_COMMON_ARGS
2059#undef STMT_COMMON_CALL
2061#define CREATE_EXPRESSION(size) \
2062 TapeTypes::StatementEvaluator::template createHandle<Impl, JacobianStatementGenerator<Impl, size>, \
2063 AssignStatement<ActiveType<Impl>, JacobianExpression<size>>>()
2066 template<
typename TapeTypes,
typename Impl>
2067 const CODI_DD(
typename TapeTypes::EvalHandle,
2069 CREATE_EXPRESSION(0), CREATE_EXPRESSION(1), CREATE_EXPRESSION(2), CREATE_EXPRESSION(3),
2070 CREATE_EXPRESSION(4), CREATE_EXPRESSION(5), CREATE_EXPRESSION(6), CREATE_EXPRESSION(7),
2071 CREATE_EXPRESSION(8), CREATE_EXPRESSION(9), CREATE_EXPRESSION(10), CREATE_EXPRESSION(11),
2072 CREATE_EXPRESSION(12), CREATE_EXPRESSION(13), CREATE_EXPRESSION(14), CREATE_EXPRESSION(15),
2073 CREATE_EXPRESSION(16), CREATE_EXPRESSION(17), CREATE_EXPRESSION(18), CREATE_EXPRESSION(19),
2074 CREATE_EXPRESSION(20), CREATE_EXPRESSION(21), CREATE_EXPRESSION(22), CREATE_EXPRESSION(23),
2075 CREATE_EXPRESSION(24), CREATE_EXPRESSION(25), CREATE_EXPRESSION(26), CREATE_EXPRESSION(27),
2076 CREATE_EXPRESSION(28), CREATE_EXPRESSION(29), CREATE_EXPRESSION(30), CREATE_EXPRESSION(31),
2077 CREATE_EXPRESSION(32), CREATE_EXPRESSION(33), CREATE_EXPRESSION(34), CREATE_EXPRESSION(35),
2078 CREATE_EXPRESSION(36), CREATE_EXPRESSION(37), CREATE_EXPRESSION(38), CREATE_EXPRESSION(39),
2079 CREATE_EXPRESSION(40), CREATE_EXPRESSION(41), CREATE_EXPRESSION(42), CREATE_EXPRESSION(43),
2080 CREATE_EXPRESSION(44), CREATE_EXPRESSION(45), CREATE_EXPRESSION(46), CREATE_EXPRESSION(47),
2081 CREATE_EXPRESSION(48), CREATE_EXPRESSION(49), CREATE_EXPRESSION(50), CREATE_EXPRESSION(51),
2082 CREATE_EXPRESSION(52), CREATE_EXPRESSION(53), CREATE_EXPRESSION(54), CREATE_EXPRESSION(55),
2083 CREATE_EXPRESSION(56), CREATE_EXPRESSION(57), CREATE_EXPRESSION(58), CREATE_EXPRESSION(59),
2084 CREATE_EXPRESSION(60), CREATE_EXPRESSION(61), CREATE_EXPRESSION(62), CREATE_EXPRESSION(63),
2085 CREATE_EXPRESSION(64), CREATE_EXPRESSION(65), CREATE_EXPRESSION(66), CREATE_EXPRESSION(67),
2086 CREATE_EXPRESSION(68), CREATE_EXPRESSION(69), CREATE_EXPRESSION(70), CREATE_EXPRESSION(71),
2087 CREATE_EXPRESSION(72), CREATE_EXPRESSION(73), CREATE_EXPRESSION(74), CREATE_EXPRESSION(75),
2088 CREATE_EXPRESSION(76), CREATE_EXPRESSION(77), CREATE_EXPRESSION(78), CREATE_EXPRESSION(79),
2089 CREATE_EXPRESSION(80), CREATE_EXPRESSION(81), CREATE_EXPRESSION(82), CREATE_EXPRESSION(83),
2090 CREATE_EXPRESSION(84), CREATE_EXPRESSION(85), CREATE_EXPRESSION(86), CREATE_EXPRESSION(87),
2091 CREATE_EXPRESSION(88), CREATE_EXPRESSION(89), CREATE_EXPRESSION(90), CREATE_EXPRESSION(91),
2092 CREATE_EXPRESSION(92), CREATE_EXPRESSION(93), CREATE_EXPRESSION(94), CREATE_EXPRESSION(95),
2093 CREATE_EXPRESSION(96), CREATE_EXPRESSION(97), CREATE_EXPRESSION(98), CREATE_EXPRESSION(99),
2094 CREATE_EXPRESSION(100), CREATE_EXPRESSION(101), CREATE_EXPRESSION(102), CREATE_EXPRESSION(103),
2095 CREATE_EXPRESSION(104), CREATE_EXPRESSION(105), CREATE_EXPRESSION(106), CREATE_EXPRESSION(107),
2096 CREATE_EXPRESSION(108), CREATE_EXPRESSION(109), CREATE_EXPRESSION(110), CREATE_EXPRESSION(111),
2097 CREATE_EXPRESSION(112), CREATE_EXPRESSION(113), CREATE_EXPRESSION(114), CREATE_EXPRESSION(115),
2098 CREATE_EXPRESSION(116), CREATE_EXPRESSION(117), CREATE_EXPRESSION(118), CREATE_EXPRESSION(119),
2099 CREATE_EXPRESSION(120), CREATE_EXPRESSION(121), CREATE_EXPRESSION(122), CREATE_EXPRESSION(123),
2100 CREATE_EXPRESSION(124), CREATE_EXPRESSION(125), CREATE_EXPRESSION(126), CREATE_EXPRESSION(127),
2101 CREATE_EXPRESSION(128), CREATE_EXPRESSION(129), CREATE_EXPRESSION(130), CREATE_EXPRESSION(131),
2102 CREATE_EXPRESSION(132), CREATE_EXPRESSION(133), CREATE_EXPRESSION(134), CREATE_EXPRESSION(135),
2103 CREATE_EXPRESSION(136), CREATE_EXPRESSION(137), CREATE_EXPRESSION(138), CREATE_EXPRESSION(139),
2104 CREATE_EXPRESSION(140), CREATE_EXPRESSION(141), CREATE_EXPRESSION(142), CREATE_EXPRESSION(143),
2105 CREATE_EXPRESSION(144), CREATE_EXPRESSION(145), CREATE_EXPRESSION(146), CREATE_EXPRESSION(147),
2106 CREATE_EXPRESSION(148), CREATE_EXPRESSION(149), CREATE_EXPRESSION(150), CREATE_EXPRESSION(151),
2107 CREATE_EXPRESSION(152), CREATE_EXPRESSION(153), CREATE_EXPRESSION(154), CREATE_EXPRESSION(155),
2108 CREATE_EXPRESSION(156), CREATE_EXPRESSION(157), CREATE_EXPRESSION(158), CREATE_EXPRESSION(159),
2109 CREATE_EXPRESSION(160), CREATE_EXPRESSION(161), CREATE_EXPRESSION(162), CREATE_EXPRESSION(163),
2110 CREATE_EXPRESSION(164), CREATE_EXPRESSION(165), CREATE_EXPRESSION(166), CREATE_EXPRESSION(167),
2111 CREATE_EXPRESSION(168), CREATE_EXPRESSION(169), CREATE_EXPRESSION(170), CREATE_EXPRESSION(171),
2112 CREATE_EXPRESSION(172), CREATE_EXPRESSION(173), CREATE_EXPRESSION(174), CREATE_EXPRESSION(175),
2113 CREATE_EXPRESSION(176), CREATE_EXPRESSION(177), CREATE_EXPRESSION(178), CREATE_EXPRESSION(179),
2114 CREATE_EXPRESSION(180), CREATE_EXPRESSION(181), CREATE_EXPRESSION(182), CREATE_EXPRESSION(183),
2115 CREATE_EXPRESSION(184), CREATE_EXPRESSION(185), CREATE_EXPRESSION(186), CREATE_EXPRESSION(187),
2116 CREATE_EXPRESSION(188), CREATE_EXPRESSION(189), CREATE_EXPRESSION(190), CREATE_EXPRESSION(191),
2117 CREATE_EXPRESSION(192), CREATE_EXPRESSION(193), CREATE_EXPRESSION(194), CREATE_EXPRESSION(195),
2118 CREATE_EXPRESSION(196), CREATE_EXPRESSION(197), CREATE_EXPRESSION(198), CREATE_EXPRESSION(199),
2119 CREATE_EXPRESSION(200), CREATE_EXPRESSION(201), CREATE_EXPRESSION(202), CREATE_EXPRESSION(203),
2120 CREATE_EXPRESSION(204), CREATE_EXPRESSION(205), CREATE_EXPRESSION(206), CREATE_EXPRESSION(207),
2121 CREATE_EXPRESSION(208), CREATE_EXPRESSION(209), CREATE_EXPRESSION(210), CREATE_EXPRESSION(211),
2122 CREATE_EXPRESSION(212), CREATE_EXPRESSION(213), CREATE_EXPRESSION(214), CREATE_EXPRESSION(215),
2123 CREATE_EXPRESSION(216), CREATE_EXPRESSION(217), CREATE_EXPRESSION(218), CREATE_EXPRESSION(219),
2124 CREATE_EXPRESSION(220), CREATE_EXPRESSION(221), CREATE_EXPRESSION(222), CREATE_EXPRESSION(223),
2125 CREATE_EXPRESSION(224), CREATE_EXPRESSION(225), CREATE_EXPRESSION(226), CREATE_EXPRESSION(227),
2126 CREATE_EXPRESSION(228), CREATE_EXPRESSION(229), CREATE_EXPRESSION(230), CREATE_EXPRESSION(231),
2127 CREATE_EXPRESSION(232), CREATE_EXPRESSION(233), CREATE_EXPRESSION(234), CREATE_EXPRESSION(235),
2128 CREATE_EXPRESSION(236), CREATE_EXPRESSION(237), CREATE_EXPRESSION(238), CREATE_EXPRESSION(239),
2129 CREATE_EXPRESSION(240), CREATE_EXPRESSION(241), CREATE_EXPRESSION(242), CREATE_EXPRESSION(243),
2130 CREATE_EXPRESSION(244), CREATE_EXPRESSION(245), CREATE_EXPRESSION(246), CREATE_EXPRESSION(247),
2131 CREATE_EXPRESSION(248), CREATE_EXPRESSION(249), CREATE_EXPRESSION(250), CREATE_EXPRESSION(251),
2132 CREATE_EXPRESSION(252)};
2134#undef CREATE_EXPRESSION
#define CODI_Unlikely
Declare unlikely evaluation of an execution path.
Definition config.h:408
#define CODI_LAMBDA_INLINE
See codi::Config::ForcedInlines.
Definition config.h:473
#define CODI_NO_INLINE
See codi::Config::AvoidedInlines.
Definition config.h:426
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:469
#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_RESTRICT
See codi::Config::Restrict.
Definition config.h:491
#define codiAssert(x)
See codi::Config::EnableAssert.
Definition config.h:441
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:96
#define CODI_ENABLE_CHECK(option, condition)
Definition macros.hpp:61
#define CODI_WRAP_FUNCTION(NAME, FUNC)
Wrap a function in a function object. Used for performance optimizations.
Definition macros.hpp:165
#define CODI_ANY
Used in default declarations of expression templates.
Definition macros.hpp:100
#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
Configuration options for CoDiPack.
Definition config.h:65
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
const bool CheckEmptyStatements
Tapes push statements only if at least one Jacobian was pushed.
Definition config.h:154
size_t constexpr ChunkSize
Default size of chunks (ChunkBase) used in ChunkedData in reverse tape implementations.
Definition config.h:94
bool constexpr CheckZeroIndex
Ignore active types that are not dependent on any input value in Jacobian tapes.
Definition config.h:178
bool constexpr IgnoreInvalidJacobians
Ignore invalid Jacobians like NaN or Inf.
Definition config.h:240
bool constexpr CheckTapeActivity
Makes it possible to ignore certain code parts. If turned of everything will be recorded.
Definition config.h:170
size_t constexpr StatementLowLevelFunctionTag
Statement tag for low level functions.
Definition config.h:126
size_t constexpr MaxArgumentSize
Maximum number of arguments in a statement.
Definition config.h:120
bool constexpr StatementEvents
Enable statement events. Disabled by default.
Definition config.h:328
bool constexpr CopyOptimization
Do not store copy statements like a = b; if the identity handler allows it.
Definition config.h:186
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
size_t constexpr StatementInputTag
Tag for statements that are inputs. Used in linear index management context.
Definition config.h:123
bool constexpr SkipZeroAdjointEvaluation
Do not perform a reverse evaluation of a statement if the seeding adjoint is zero.
Definition config.h:256
inlinestd::array< AtomicTraits::RemoveAtomic< typename TraitsImplementation< Gradient >::Real >, TraitsImplementation< Gradient >::dim > toArray(Gradient const &gradient)
Converts the (possibly multi-component) gradient to an array of Reals.
Definition gradientTraits.hpp:116
inlinesize_t constexpr dim()
Number of dimensions this gradient value has.
Definition gradientTraits.hpp:96
inlinebool isTotalFinite(Type const &v)
Function for checking if all values of the type are finite.
Definition realTraits.hpp:139
inlinebool isTotalZero(Type const &v)
Function for checking if the value of the type is completely zero.
Definition realTraits.hpp:145
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
IntegralType getNextMultiple(IntegralType const &targetSize, IntegralType const &chunkSize)
Helper function for overallocation in multiples of a given chunk size.
Definition mathUtility.hpp:49
std::string demangleName()
Return a string of the provided template name.
Definition demangleName.hpp:47
TapeParameters
Configuration options for a tape.
Definition tapeParameters.hpp:52
@ StatementByteSize
[A: RW] Allocated size of the byte data for the statement data.
Definition tapeParameters.hpp:67
@ LargestIdentifier
[A: R] Largest identifier distributed by the index manger.
Definition tapeParameters.hpp:60
@ PrimalSize
[A: RW] Number of primal vector entries in primal value tapes.
Definition tapeParameters.hpp:63
@ StatementSize
[A: RW] Allocated number of entries in the statement vector in all tapes.
Definition tapeParameters.hpp:66
@ AdjointSize
Definition tapeParameters.hpp:53
inlinevoid static_for(F func, Args &&... args)
Static for with i = 0 .. (N - 1). See CompileTimeLoop for details.
Definition compileTimeLoop.hpp:110
StatementCall
Defines all the operations which can be evaluated on a statement by a tape.
Definition statementEvaluatorTapeInterface.hpp:45
@ WriteInformation
Get write information.
Definition statementEvaluatorTapeInterface.hpp:51
@ ResetPrimals
Restore the primal values.
Definition statementEvaluatorTapeInterface.hpp:49
@ ClearAdjoints
Clear the adjoint values.
Definition statementEvaluatorTapeInterface.hpp:46
typename ArrayAccessExpressionImpl< Aggregated, element >::template Expression< Arg > ArrayAccessExpression
Expression that performs a[element] in a compile time context.
Definition arrayAccessExpression.hpp:98
inlineauto real(ExpressionInterface< std::complex< Real >, Arg > const &arg)
Function overload for FUNCTION.
Definition allOperators.hpp:75
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
InnerActiveType values[Elements]
Array representation.
Definition aggregatedActiveType.hpp:75
Represents a concrete aggregated lvalue int the CoDiPack expression tree.
Definition aggregatedActiveType.hpp:164
Definition assignStatement.hpp:50
Definition byteDataView.hpp:51
inlinevoid internalStoreLowLevelFunction(Config::LowLevelFunctionToken token, size_t size, ByteDataView &dataView)
Definition commonTapeImplementation.hpp:494
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 complet...
Definition commonTapeImplementation.hpp:200
Real manualPushLhsValue
For storeManual, remember the value assigned to the lhs.
Definition commonTapeImplementation.hpp:158
void setParameter(TapeParameters parameter, size_t value)
Definition commonTapeImplementation.hpp:459
void evaluateForward(AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Definition commonTapeImplementation.hpp:611
size_t manualPushCounter
Count the pushes after storeManual, to identify the last push.
Definition commonTapeImplementation.hpp:161
inlinevoid resetTo(Position const &pos, bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Definition commonTapeImplementation.hpp:723
Identifier manualPushLhsIdentifier
For storeManual, remember the identifier assigned to the lhs.
Definition commonTapeImplementation.hpp:159
bool isActive() const
Definition commonTapeImplementation.hpp:320
size_t manualPushGoal
Store the number of expected pushes after a storeManual call.
Definition commonTapeImplementation.hpp:160
void init(typename ImplTapeTypes::NestedData *nested)
Definition commonTapeImplementation.hpp:770
std::set< TapeParameters > options
All options.
Definition commonTapeImplementation.hpp:153
void writeTape(std::unique_ptr< TapeWriterInterface< Type > > writer)
Definition commonTapeImplementation.hpp:624
void evaluate(AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Definition commonTapeImplementation.hpp:293
void swap(Impl &other)
Definition commonTapeImplementation.hpp:368
inlinevoid reset(bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Definition commonTapeImplementation.hpp:355
typename CommonTapeTypes< ImplTapeTypes >::Position Position
Definition commonTapeImplementation.hpp:145
LowLevelFunctionByteData llfByteData
Byte data for low level functions.
Definition commonTapeImplementation.hpp:156
CommonTapeImplementation()
Definition commonTapeImplementation.hpp:232
size_t getParameter(TapeParameters parameter) const
Definition commonTapeImplementation.hpp:431
void evaluatePrimal()
Definition commonTapeImplementation.hpp:745
Helper class for the construction of an expression in a different context.
Definition constructStaticContext.hpp:69
Rhs ResultType
Definition constructStaticContext.hpp:85
static ResultType construct(Real *primalVector, Identifier const *const identifiers, PassiveReal const *const constantData)
Data stream interface for tape data. Encapsulates data that is written e.g. for each statement or arg...
Definition dataInterface.hpp:149
static inlinevoid notifyTapeRegisterInputListeners(Tape &tape, Real &value, Identifier &identifier)
Invoke callbacks for TapeRegisterInput events.
Definition eventSystem.hpp:424
static inlinevoid notifyTapeEvaluateListeners(Tape &tape, Position const &start, Position const &end, VectorAccess *adjoint, EventHints::EvaluationKind evalKind, EventHints::Endpoint endpoint)
Invoke callbacks for TapeEvaluate events.
Definition eventSystem.hpp:486
static inlinevoid notifyStatementStoreOnTapeListeners(Tape &tape, Identifier const &lhsIdentifier, Real const &newValue, size_t numActiveVariables, Identifier const *rhsIdentifiers, Real const *jacobians)
Invoke callbacks for StatementStoreOnTape events.
Definition eventSystem.hpp:676
static inlinevoid notifyStatementEvaluatePrimalListeners(Tape &tape, Identifier const &lhsIdentifier, Real const &lhsValue)
Invoke callbacks for StatementEvaluatePrimal events.
Definition eventSystem.hpp:745
static inlinevoid notifyStatementEvaluateListeners(Tape &tape, Identifier const &lhsIdentifier, size_t sizeLhsAdjoint, Real const *lhsAdjoint)
Invoke callbacks for StatementEvaluate events.
Definition eventSystem.hpp:712
Base class for all CoDiPack expressions.
Definition expressionInterface.hpp:60
inlineImpl const & cast() const
Cast to the implementation.
Definition expressionInterface.hpp:76
static size_t constexpr value
Number of arguments.
Definition primalValueBaseTape.hpp:1802
Counts the number of nodes that inherit from LhsExpressionInterface in the expression.
Definition expressionTraits.hpp:226
static size_t constexpr value
See NumberOfActiveTypeArguments.
Definition expressionTraits.hpp:240
static size_t constexpr value
Always zero.
Definition primalValueBaseTape.hpp:1808
Counts the number of types that inherit from ConstantExpression in the expression.
Definition expressionTraits.hpp:250
static size_t constexpr value
See NumberOfConstantTypeArguments.
Definition expressionTraits.hpp:264
Implement logic for leaf nodes only.
Definition forEachLeafLogic.hpp:60
Indices enable the mapping of primal values to their adjoint counterparts.
Definition indexManagerInterface.hpp:78
Definition jacobianComputationLogic.hpp:54
Specialized for NumberOfActiveTypeArguments and NumberOfConstantTypeArguments.
Definition primalValueBaseTape.hpp:1797
inlinestatic void evaluate(Gradient *adjointVector, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:1913
StatementCallGeneratorBase< Stmt, StatementCallGenerator< StatementCall::ClearAdjoints, Stmt > > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:1885
inlinestatic void evaluateInner()
Evaluate expression in a forward mode.
Definition primalValueBaseTape.hpp:1888
inlinestatic void evaluateFull(Func const &func, size_t const &maxOutputArgs, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Gradient *adjointVector, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Load the expression data and evaluate the expression.
Definition primalValueBaseTape.hpp:1892
static void evaluateInner()
Throws exception.
Definition primalValueBaseTape.hpp:1922
static void evaluate()
Throws exception.
Definition primalValueBaseTape.hpp:1927
static void evaluateInner()
Throws exception.
Definition primalValueBaseTape.hpp:1936
static void evaluate()
Throws exception.
Definition primalValueBaseTape.hpp:1941
inlinestatic void evaluateInner()
Evaluate expression in a forward mode.
Definition primalValueBaseTape.hpp:2008
inlinestatic void evaluateFull(Func const &evalInner, size_t const &maxOutputArgs, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Real *primalVector, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Load the expression data and evaluate the expression.
Definition primalValueBaseTape.hpp:2012
StatementCallGeneratorBase< Stmt, StatementCallGenerator< StatementCall::ResetPrimals, Stmt > > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:2005
inlinestatic void evaluate(Real *primalVector, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:2028
StatementCallGeneratorBase< Stmt, StatementCallGenerator< StatementCall::Reverse, Stmt > > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:1952
static void evaluateInner(Real *primalVector, Gradient *adjointVector, Gradient *lhsAdjoints, PassiveReal const *const constantValues, Identifier const *const rhsIdentifiers)
Evaluate expression in a forward mode.
Definition primalValueBaseTape.hpp:1955
static void evaluate(TapeImpl &tape, Gradient *lhsAdjoints, Real *primalVector, Gradient *adjointVector, size_t &linearAdjointPos, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:1963
This structure is accessed by the StatementEvaluatorInterface.
Definition primalValueBaseTape.hpp:1843
Definition primalValueBaseTape.hpp:1815
typename TapeImpl::Identifier Identifier
See PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:1826
typename TapeImpl::Real Real
See PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:1824
typename TapeImpl::StatementDataPointers StatementDataPointers
Defined in PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:1829
static size_t constexpr size
See JacobianStatementGenerator.
Definition primalValueBaseTape.hpp:1822
T_TapeImpl TapeImpl
PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:1818
typename TapeImpl::PassiveReal PassiveReal
See PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:1827
typename TapeImpl::template StatementCallGeneratorBase< Rhs, Impl > StatementCallGeneratorBase
Base for statement generators.
Definition primalValueBaseTape.hpp:1835
static size_t constexpr LinearIndexHandling
See PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:1831
typename TapeImpl::Gradient Gradient
See PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:1825
Default implementation of the Jacobian interface.
Definition jacobian.hpp:60
Base class for all CoDiPack lvalue expression.
Definition lhsExpressionInterface.hpp:63
inlineImpl & cast()
Cast to the implementation.
Definition lhsExpressionInterface.hpp:99
Creates a math representation from a given rhs in the form of a string.
Definition mathStatementGenLogic.hpp:57
inlinevoid eval(NodeInterface< Node > const &node, std::string &mathRep)
Produces a math representation string for a given statement.
Definition mathStatementGenLogic.hpp:66
Defines a member that can either be static or local to the struct.
Definition memberStore.hpp:56
Implementation of VectorAccessInterface for adjoint and primal vectors.
Definition primalAdjointVectorAccess.hpp:59
Count all arguments that have non-zero index.
Definition primalValueBaseTape.hpp:397
inlinevoid handleActive(Node const &node, size_t &numberOfActiveArguments)
Called for leaf nodes which implement LhsExpressionInterface.
Definition primalValueBaseTape.hpp:402
Perform the adjoint update based on the configuration in codi::Config::VariableAdjointInterfaceInPrim...
Definition primalValueBaseTape.hpp:788
inlinevoid handleJacobianOnActive(Node const &node, Real jacobian, Gradient &lhsTangent, Gradient *adjointVector)
Called for leaf nodes which implement LhsExpressionInterface.
Definition primalValueBaseTape.hpp:793
Perform the adjoint update based on the configuration in codi::Config::VariableAdjointInterfaceInPrim...
Definition primalValueBaseTape.hpp:842
inlinevoid handleJacobianOnActive(Node const &node, Real jacobian, Gradient const &lhsAdjoint, Gradient *adjointVector)
See IncrementReversalLogic.
Definition primalValueBaseTape.hpp:847
Push all data for each argument.
Definition primalValueBaseTape.hpp:410
inlinevoid handleActive(Node const &node, StatementDataPointers &pointers, size_t &curPassiveArgument)
Called for leaf nodes which implement LhsExpressionInterface.
Definition primalValueBaseTape.hpp:415
inlinevoid handleConstant(Node const &node, StatementDataPointers &pointers, size_t &curPassiveArgument)
Called for leaf nodes which implement ConstantExpression.
Definition primalValueBaseTape.hpp:429
Base class for statement call generators. Prepares the static construction context.
Definition primalValueBaseTape.hpp:1334
ArrayAccessExpression< LhsReal, pos, StaticRhs > ExtractExpr
Extract expressions for aggregated types.
Definition primalValueBaseTape.hpp:1345
inlinestatic StaticRhs constructStaticRhs(Real *primalVector, PassiveReal const *const constantValues, Identifier const *const identifiers)
Construct the statement in the static context.
Definition primalValueBaseTape.hpp:1349
typename Lhs::Real LhsReal
Primal value of lhs.
Definition primalValueBaseTape.hpp:1338
typename Stmt::Lhs Lhs
See AssignStatement.
Definition primalValueBaseTape.hpp:1336
typename Constructor::ResultType StaticRhs
Static right hand side.
Definition primalValueBaseTape.hpp:1342
inlinestatic void internalEvaluate(Args &&... args)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:1357
RealTraits::AggregatedTypeTraits< LhsReal > AggregateTraits
Traits for aggregated type.
Definition primalValueBaseTape.hpp:1339
typename Stmt::Rhs Rhs
See AssignStatement.
Definition primalValueBaseTape.hpp:1337
ConstructStaticContextLogic< Rhs, Impl, 0, 0 > Constructor
Static construction context.
Definition primalValueBaseTape.hpp:1341
inlinestatic void evaluate(Gradient *adjointVector, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:1467
typename Base::StaticRhs StaticRhs
See StatementCallGeneratorBase.
Definition primalValueBaseTape.hpp:1438
StatementCallGeneratorBase< Stmt, StatementCallGenerator< StatementCall::ClearAdjoints, Stmt > > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:1437
inlinestatic void evaluateInner()
Evaluate expression in a forward mode.
Definition primalValueBaseTape.hpp:1441
inlinestatic void evaluateFull(Func const &evalInner, size_t const &maxOutputArgs, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Gradient *adjointVector, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Load the expression data and evaluate the expression.
Definition primalValueBaseTape.hpp:1445
inlinestatic void evaluate(Impl &tape, Real *lhsPrimals, Gradient *lhsTangents, Real *primalVector, Gradient *adjointVector, size_t &linearAdjointPos, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:1557
inlinestatic void evaluateInner(Real *primalVector, Gradient *adjointVector, Real *lhsPrimals, Gradient *lhsTangents, PassiveReal const *const constantValues, Identifier const *const rhsIdentifiers)
Evaluate expression in a forward mode.
Definition primalValueBaseTape.hpp:1486
inlinestatic void evaluateFull(Func const &evalInner, size_t const &maxOutputArgs, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Impl &tape, Real *lhsPrimals, Gradient *lhsTangents, Real *primalVector, Gradient *adjointVector, size_t &linearAdjointPos, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Load the expression data and evaluate the expression.
Definition primalValueBaseTape.hpp:1510
StatementCallGeneratorBase< Stmt, StatementCallGenerator< StatementCall::Forward, Stmt > > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:1479
typename Base::template ExtractExpr< pos > ExtractExpr
See StatementCallGeneratorBase.
Definition primalValueBaseTape.hpp:1483
typename Base::StaticRhs StaticRhs
See StatementCallGeneratorBase.
Definition primalValueBaseTape.hpp:1480
typename Base::template ExtractExpr< pos > ExtractExpr
See StatementCallGeneratorBase.
Definition primalValueBaseTape.hpp:1577
inlinestatic void evaluate(Impl &tape, Real *lhsPrimals, Real *primalVector, size_t &linearAdjointPos, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:1629
StatementCallGeneratorBase< Stmt, StatementCallGenerator< StatementCall::Primal, Stmt > > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:1573
inlinestatic void evaluateFull(Func const &evalInner, size_t const &maxOutputArgs, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Impl &tape, Real *lhsPrimals, Real *primalVector, size_t &linearAdjointPos, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Load the expression data and evaluate the expression.
Definition primalValueBaseTape.hpp:1594
inlinestatic void evaluateInner(Real *lhsPrimals, Real *primalVector, PassiveReal const *const constantValues, Identifier const *const rhsIdentifiers)
Evaluate expression in a forward mode.
Definition primalValueBaseTape.hpp:1580
typename Base::StaticRhs StaticRhs
See StatementCallGeneratorBase.
Definition primalValueBaseTape.hpp:1574
typename Base::StaticRhs StaticRhs
See StatementCallGeneratorBase.
Definition primalValueBaseTape.hpp:1738
inlinestatic void evaluate(Real *primalVector, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:1763
inlinestatic void evaluateInner()
Evaluate expression in a forward mode.
Definition primalValueBaseTape.hpp:1741
StatementCallGeneratorBase< Stmt, StatementCallGenerator< StatementCall::ResetPrimals, Stmt > > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:1737
inlinestatic void evaluateFull(Func const &evalInner, size_t const &maxOutputArgs, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Real *primalVector, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Load the expression data and evaluate the expression.
Definition primalValueBaseTape.hpp:1745
inlinestatic void evaluateInner(Real *primalVector, Gradient *adjointVector, Gradient *lhsAdjoints, PassiveReal const *const constantValues, Identifier const *const rhsIdentifiers)
Evaluate expression in a forward mode.
Definition primalValueBaseTape.hpp:1650
inlinestatic void evaluate(Impl &tape, Gradient *lhsAdjoints, Real *primalVector, Gradient *adjointVector, size_t &linearAdjointPos, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Evaluate the full expression.
Definition primalValueBaseTape.hpp:1722
inlinestatic void evaluateFull(Func const &evalInner, size_t const &maxOutputArgs, size_t const &maxActiveArgs, size_t const &maxConstantArgs, Impl &tape, Gradient *lhsAdjoints, Real *primalVector, Gradient *adjointVector, size_t &linearAdjointPos, Config::ArgumentSize numberOfPassiveArguments, char *byteData)
Load the expression data and evaluate the expression.
Definition primalValueBaseTape.hpp:1669
typename Base::template ExtractExpr< pos > ExtractExpr
See StatementCallGeneratorBase.
Definition primalValueBaseTape.hpp:1647
typename Base::StaticRhs StaticRhs
See StatementCallGeneratorBase.
Definition primalValueBaseTape.hpp:1644
StatementCallGeneratorBase< Stmt, StatementCallGenerator< StatementCall::Reverse, Stmt > > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:1643
This structure is accessed by the StatementEvaluatorInterface.
Definition primalValueBaseTape.hpp:1369
Definition of the data for a statement. The pointers a populated from a byte data stream.
Definition primalValueBaseTape.hpp:306
inlinevoid populate(size_t lhsSize, size_t rhsSize, size_t passiveSize, size_t constantSize, char *byteData)
Set all the pointer from the given byte data. The sizes are used to compute the offsets.
Definition primalValueBaseTape.hpp:322
Real * passiveValues
Array for the passive values of a statement.
Definition primalValueBaseTape.hpp:309
inlineConfig::LowLevelFunctionDataSize computeSize(size_t lhsSize, size_t rhsSize, size_t passiveSize, size_t constantSize)
Computes the byte size for the data of the statement.
Definition primalValueBaseTape.hpp:347
PassiveReal * constantValues
Array for the constant values in the statement.
Definition primalValueBaseTape.hpp:311
Identifier * rhsIdentifiers
Array for the rhs identifiers.
Definition primalValueBaseTape.hpp:307
inlinevoid push(T *&array, T const &value)
Definition primalValueBaseTape.hpp:316
Real * oldLhsValues
Array for the old values of the lhs values.
Definition primalValueBaseTape.hpp:310
Identifier * lhsIdentifiers
Array for the lhs identifiers.
Definition primalValueBaseTape.hpp:308
Additional wrapper that triggers compiler optimizations.
Definition primalValueBaseTape.hpp:808
Wrapper helper for improved compiler optimizations.
Definition primalValueBaseTape.hpp:1291
Additional wrapper that triggers compiler optimizations.
Definition primalValueBaseTape.hpp:862
Base class for all standard Primal value tape implementations.
Definition primalValueBaseTape.hpp:131
MemberStore< IndexManager, Impl, TapeTypes::IsStaticIndexHandler > indexManager
Definition primalValueBaseTape.hpp:179
inlineGradient * getInternalAdjoints()
Obtain a representation of the tape's internal adjoint vector that can be used as custom adjoints.
Definition primalValueBaseTape.hpp:914
std::vector< Real > primalsCopy
Definition primalValueBaseTape.hpp:185
typename TapeTypes::EvalHandle EvalHandle
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:150
inlineConfig::LowLevelFunctionDataSize reserveStmtDataManual(size_t lhsSize, size_t rhsSize, size_t passiveSize, size_t constantSize, StatementDataPointers &pointers)
Reserve all the data for a statement.
Definition primalValueBaseTape.hpp:368
static bool constexpr RequiresPrimalRestore
Definition primalValueBaseTape.hpp:168
void beginUseAdjointVector()
Declare that the adjoint vector is being used. See Adjoint vector management.
Definition primalValueBaseTape.hpp:950
inlineReal internalRegisterInput(LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value, bool unusedIndex)
Add a new input to the tape and update the primal value vector.
Definition primalValueBaseTape.hpp:664
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.
Definition primalValueBaseTape.hpp:590
inlinevoid evaluateForward(Position const &start, Position const &end, AdjointVector &&data)
Perform a forward evaluation of a part of the tape. It has to hold start <= end.
Definition primalValueBaseTape.hpp:909
inlinevoid registerInput(LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
Definition primalValueBaseTape.hpp:697
PrimalValueBaseTape()
Constructor.
Definition primalValueBaseTape.hpp:228
inlinebool storeArgumentAndStmtData(ExpressionInterface< RhsType, Rhs > const &rhs, StatementDataPointers &pointers)
Definition primalValueBaseTape.hpp:450
Gradient * selectAdjointVector(VectorAccess< AdjointVector > *vectorAccess, AdjointVector data)
Select the configured adjoint vector, see codi::Config::VariableAdjointInterfaceInPrimalTapes.
Definition primalValueBaseTape.hpp:773
T_Impl Impl
See PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:139
void deleteAdjointVector()
Delete the adjoint vector. See Adjoint vector management.
Definition primalValueBaseTape.hpp:939
Real registerExternalFunctionOutput(LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
Definition primalValueBaseTape.hpp:1034
StatementByteData statementByteData
Definition primalValueBaseTape.hpp:181
Real const & primal(Identifier const &identifier) const
Read only reference to primal value.
Definition primalValueBaseTape.hpp:1323
static bool constexpr HasPrimalValues
Definition primalValueBaseTape.hpp:165
CommonTapeImplementation< T_TapeTypes, T_Impl > Base
Base class abbreviation.
Definition primalValueBaseTape.hpp:141
typename TapeTypes::StatementEvaluator StatementEvaluator
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:147
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 evalu...
Definition primalValueBaseTape.hpp:1276
inlinevoid destroyIdentifier(Real &value, Identifier &identifier)
Has to be called for each identifier, before it is deallocated.
Definition primalValueBaseTape.hpp:297
inlinevoid store(AggregatedActiveType< Aggregated, Type, Lhs > &lhs, ExpressionInterface< Aggregated, Rhs > const &rhs)
Definition primalValueBaseTape.hpp:505
inlinevoid resetTo(Position const &pos, bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Reset the tape to the provided position.
Definition primalValueBaseTape.hpp:1224
std::vector< Real > primals
Definition primalValueBaseTape.hpp:184
typename TapeTypes::Real Real
See TapeTypesInterface.
Definition primalValueBaseTape.hpp:144
static void internalEvaluateReverse_EvalStatements(Args &&... args)
Perform a reverse evaluation of the tape. Arguments are from the recursive eval methods of the DataIn...
typename TapeTypes::StatementByteData StatementByteData
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:153
inlinevoid 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.
Definition primalValueBaseTape.hpp:903
std::vector< Gradient > adjoints
Definition primalValueBaseTape.hpp:183
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 evalu...
Definition primalValueBaseTape.hpp:1263
typename TapeTypes::Identifier Identifier
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:148
inlinevoid clearAdjoints(AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Clear all adjoint values, that is, set them to zero.
Definition primalValueBaseTape.hpp:705
inlinevoid initIdentifier(Real &value, Identifier &identifier)
Definition primalValueBaseTape.hpp:289
T_TapeTypes TapeTypes
See PrimalValueBaseTape.
Definition primalValueBaseTape.hpp:135
Identifier * manualPushIdentifiers
Definition primalValueBaseTape.hpp:189
static bool constexpr AllowJacobianOptimization
Definition primalValueBaseTape.hpp:164
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 evalu...
Definition primalValueBaseTape.hpp:1252
VectorAccess< Adjoint * > * createVectorAccessCustomAdjoints(Adjoint *data)
Definition primalValueBaseTape.hpp:1018
Real * manualPushJacobians
Definition primalValueBaseTape.hpp:187
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 evalu...
Definition primalValueBaseTape.hpp:1239
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.
Definition primalValueBaseTape.hpp:561
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.
Definition primalValueBaseTape.hpp:1048
void deleteVectorAccess(VectorAccessInterface< Real, Identifier > *access)
See Adjoint vector access.
Definition primalValueBaseTape.hpp:1023
void evaluatePrimal(Position const &start, Position const &end)
Perform a full (forward) reevaluation of the primals in the tape.
Definition primalValueBaseTape.hpp:1303
void evaluatePrimal()
Perform a full (forward) reevaluation of the primals in the tape.
Definition commonTapeImplementation.hpp:745
std::array< T, Config::MaxArgumentSize > StackArray
Used for generating arrays for lhs handling.
Definition primalValueBaseTape.hpp:173
void writeTape(codi::TapeWriterInterface< Type > *writer, Position const &start, Position const &end)
For full or partial tapes using a pointer to the writer.
Definition primalValueBaseTape.hpp:1170
static void internalEvaluatePrimal_EvalStatements(Args &&... args)
Perform a primal evaluation of the tape. Arguments are from the recursive eval methods of the DataInt...
inlineGradient & gradient(Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Reference access to gradient.
Definition primalValueBaseTape.hpp:257
void setParameter(TapeParameters parameter, size_t value)
See Parameters functions.
Definition primalValueBaseTape.hpp:981
Real & primal(Identifier const &identifier)
Definition primalValueBaseTape.hpp:1318
VectorAccess< AdjointVector > * createVectorAccessCustomAdjoints(AdjointVector &&data)
Definition primalValueBaseTape.hpp:1011
static void internalEvaluateForward_EvalStatements(Args &&... args)
Perform a forward evaluation of the tape. Arguments are from the recursive eval methods of the DataIn...
static bool constexpr LinearIndexHandling
Definition primalValueBaseTape.hpp:166
void internalEvaluateForward(Position const &start, Position const &end, AdjointVector &&data)
Internal method for the forward evaluation of the whole tape.
Definition primalValueBaseTape.hpp:812
void internalResetPrimalValues(Position const &pos)
Reset the primal values to the given position.
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.
Definition primalValueBaseTape.hpp:630
inlinevoid pushLowLevelFunction(Config::LowLevelFunctionToken token, size_t size, ByteDataView &data)
Push a low level function to the tape.
Definition primalValueBaseTape.hpp:1194
inlineGradient const & gradient(Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const
Constant reference access to gradient.
Definition primalValueBaseTape.hpp:271
inlinevoid internalEvaluateReverse(Position const &start, Position const &end, AdjointVector &&data)
Internal method for the reverse evaluation of the whole tape.
Definition primalValueBaseTape.hpp:866
RealTraits::PassiveReal< Real > PassiveReal
Basic computation type.
Definition primalValueBaseTape.hpp:155
typename Base::Position Position
See TapeTypesInterface.
Definition primalValueBaseTape.hpp:158
typename TapeTypes::Gradient Gradient
See TapeTypesInterface.
Definition primalValueBaseTape.hpp:145
VectorAccess< Gradient * > * createVectorAccess()
See Adjoint vector access.
Definition primalValueBaseTape.hpp:1005
typename StatementData::Position NestedPosition
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:157
void createStatementManual(Config::ArgumentSize const &nOutputValues, Identifier const *const lhsIndices, Real const *const lhsValues, 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)
Definition primalValueBaseTape.hpp:1121
inlineTapeValues internalGetTapeValues() const
Definition primalValueBaseTape.hpp:732
void resizeAdjointVector()
Explicitly trigger resizing of the adjoint vector. See Adjoint vector management.
Definition primalValueBaseTape.hpp:944
typename TapeTypes::StatementData StatementData
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:152
void endUseAdjointVector()
Declare that the adjoint vector is no longer used. See Adjoint vector management.
Definition primalValueBaseTape.hpp:954
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.
Definition primalValueBaseTape.hpp:1210
PrimalAdjointVectorAccess< Real, Identifier, AdjointVector > VectorAccess
Vector access type generated by this tape.
Definition primalValueBaseTape.hpp:162
inlinevoid reset(bool resetAdjoints=true, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Reset the tape to the initial state for a fresh recording.
Definition primalValueBaseTape.hpp:717
void storeManual(Real const &lhsValue, Identifier &lhsIndex, Config::ArgumentSize const &size)
Definition primalValueBaseTape.hpp:1090
inlineConfig::LowLevelFunctionDataSize reserveStmtData(size_t activeArguments, StatementDataPointers &pointers)
Reserve all the data for a statement.
Definition primalValueBaseTape.hpp:386
void pushJacobianManual(Real const &jacobian, Real const &value, Identifier const &index)
Definition primalValueBaseTape.hpp:1065
inlinevoid swap(Impl &other)
Swap all data with an other tape.
Definition primalValueBaseTape.hpp:924
StatementData statementData
Definition primalValueBaseTape.hpp:180
inlinevoid store(LhsExpressionInterface< Real, Gradient, Impl, Lhs > &lhs, Real const &rhs)
Has to be called by an AD variable every time it is assigned.
Definition primalValueBaseTape.hpp:649
friend Base
Definition primalValueBaseTape.hpp:142
size_t getParameter(TapeParameters parameter) const
See Parameters functions.
Definition primalValueBaseTape.hpp:957
IndexManager & getIndexManager()
Returns a reference to the Index Manager.
Definition primalValueBaseTape.hpp:1184
inlinevoid pushLhsData(Identifier const &index, Real const &oldPrimalValue, StatementDataPointers &pointers)
Add data for a lhs entry to the data streams.
Definition primalValueBaseTape.hpp:359
typename TapeTypes::IndexManager IndexManager
See TapeTypesInterface.
Definition primalValueBaseTape.hpp:146
Type definitions for the primal value tapes.
Definition primalValueBaseTape.hpp:81
T_Gradient Gradient
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:85
T_StatementEvaluator StatementEvaluator
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:87
typename IndexManager::Index Identifier
See IndexManagerInterface.
Definition primalValueBaseTape.hpp:93
Data< StatementByteChunk, StatementData > StatementByteData
Statement byte data vector.
Definition primalValueBaseTape.hpp:107
T_Data< Chunk, Nested > Data
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:90
static constexpr bool IsLinearIndexHandler
True if the index manager is linear.
Definition primalValueBaseTape.hpp:96
RealTraits::PassiveReal< Real > PassiveReal
Basic computation type.
Definition primalValueBaseTape.hpp:94
T_Real Real
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:84
Chunk1< char > StatementByteChunk
Binary data for the statements.
Definition primalValueBaseTape.hpp:106
Data< StatementChunk, IndexManager > StatementData
Statement data vector.
Definition primalValueBaseTape.hpp:104
T_IndexManager IndexManager
See PrimalValueTapeTypes.
Definition primalValueBaseTape.hpp:86
static constexpr bool IsStaticIndexHandler
True if the index manager must be stored statically in the tape.
Definition primalValueBaseTape.hpp:97
typename StatementEvaluator::Handle EvalHandle
Handle type returned by the statement generator.
Definition primalValueBaseTape.hpp:100
Chunk3< Config::ArgumentSize, EvalHandle, Config::LowLevelFunctionDataSize > StatementChunk
Statement chunk contains <argument size, eval handle, data size of statement in bytes>.
Definition primalValueBaseTape.hpp:103
StatementByteData NestedData
See TapeTypesInterface.
Definition primalValueBaseTape.hpp:109
Methods that access inner values of aggregated types that contain CoDiPack active types.
Definition realTraits.hpp:226
Tape side interface for StatementEvaluatorInterface.
Definition statementEvaluatorTapeInterface.hpp:97
Creation of handles for the evaluation of expressions in a context where the expression type is not a...
Definition statementEvaluatorInterface.hpp:103
Tape side interface for StatementEvaluatorInterface.
Definition statementEvaluatorTapeInterface.hpp:70
Interface for the definition of tape types.
Definition commonTapeImplementation.hpp:64
Tape information that can be printed in a pretty print format or a table format.
Definition tapeValues.hpp:75
void addUnsignedLongEntry(std::string const &name, unsigned long const &value, LocalReductionOperation operation=LocalReductionOperation::Sum)
Add unsigned long entry.
Definition tapeValues.hpp:163
void addDoubleEntry(std::string const &name, double const &value, LocalReductionOperation operation=LocalReductionOperation::Sum, bool usedMem=false, bool allocatedMem=false)
Add double entry. If it is a memory entry, it should be in bytes.
Definition tapeValues.hpp:137
void addSection(std::string const &name)
Add section. All further entries are added under this section.
Definition tapeValues.hpp:158
The interface used by all the tape writers. The tape writers are used to generate text,...
Definition tapeReaderWriterInterface.hpp:129
virtual void start(Tape &tape)
Destructor.
Definition tapeReaderWriterInterface.hpp:144
virtual void finish()
After all the statements have been written, the finish method finalizes the writing process.
Definition tapeReaderWriterInterface.hpp:178
inlinevoid eval(NodeInterface< Node > const &node, Args &&... args)
Start the evaluation of the logic on the given expression.
Definition traversalLogic.hpp:71
inlinevoid node(Node const &node, Args &&... args)
Definition traversalLogic.hpp:87
Unified access to the adjoint vector and primal vector in a tape evaluation.
Definition vectorAccessInterface.hpp:94
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
std::string stmtExpression
Used to generate a .hpp file for reading back a primal value tape.
Definition tapeReaderWriterInterface.hpp:73
size_t numberOfOutputArguments
Number of output arguments.
Definition tapeReaderWriterInterface.hpp:70
std::string mathRepresentation
Definition tapeReaderWriterInterface.hpp:74
size_t numberOfConstantArguments
Number of constant arguments.
Definition tapeReaderWriterInterface.hpp:72