Comments
parent
74269902d7
commit
c11d7885e1
|
@ -552,10 +552,16 @@ struct GenerateFunctionalNode: Argument<T, A, Base::N + 1>, Base {
|
||||||
|
|
||||||
/// Construct an execution trace for reverse AD
|
/// Construct an execution trace for reverse AD
|
||||||
void trace(const Values& values, Record* record, char*& raw) const {
|
void trace(const Values& values, Record* record, char*& raw) const {
|
||||||
Base::trace(values, record, raw);
|
Base::trace(values, record, raw); // recurse
|
||||||
|
// Write an Expression<A> execution trace in record->trace
|
||||||
|
// Iff Constant or Leaf, this will not write to raw, only to trace.
|
||||||
|
// Iff the expression is functional, write all Records in raw buffer
|
||||||
|
// Return value of type T is recorded in record->value
|
||||||
record->Record::This::value = This::expression->traceExecution(values,
|
record->Record::This::value = This::expression->traceExecution(values,
|
||||||
record->Record::This::trace, raw);
|
record->Record::This::trace, raw);
|
||||||
raw = raw + This::expression->traceSize();
|
// raw is never modified by traceExecution, but if traceExecution has
|
||||||
|
// written in the buffer, the next caller expects we advance the pointer
|
||||||
|
raw += This::expression->traceSize();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -590,12 +596,6 @@ struct FunctionalNode {
|
||||||
return static_cast<JacobianTrace<T, A, N> const &>(*this).value;
|
return static_cast<JacobianTrace<T, A, N> const &>(*this).value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access Trace
|
|
||||||
template<class A, size_t N>
|
|
||||||
ExecutionTrace<A>& trace() {
|
|
||||||
return static_cast<JacobianTrace<T, A, N>&>(*this).trace;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Access Jacobian
|
/// Access Jacobian
|
||||||
template<class A, size_t N>
|
template<class A, size_t N>
|
||||||
typename Jacobian<T, A>::type& jacobian() {
|
typename Jacobian<T, A>::type& jacobian() {
|
||||||
|
|
Loading…
Reference in New Issue