From c11d7885e132ba824eec73b191fc638a0b5d978d Mon Sep 17 00:00:00 2001 From: dellaert Date: Mon, 13 Oct 2014 11:55:16 +0200 Subject: [PATCH] Comments --- gtsam_unstable/nonlinear/Expression-inl.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gtsam_unstable/nonlinear/Expression-inl.h b/gtsam_unstable/nonlinear/Expression-inl.h index 0bc552985..6f78832b9 100644 --- a/gtsam_unstable/nonlinear/Expression-inl.h +++ b/gtsam_unstable/nonlinear/Expression-inl.h @@ -552,10 +552,16 @@ struct GenerateFunctionalNode: Argument, Base { /// Construct an execution trace for reverse AD void trace(const Values& values, Record* record, char*& raw) const { - Base::trace(values, record, raw); + Base::trace(values, record, raw); // recurse + // Write an Expression 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::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 const &>(*this).value; } - /// Access Trace - template - ExecutionTrace& trace() { - return static_cast&>(*this).trace; - } - /// Access Jacobian template typename Jacobian::type& jacobian() {