diff --git a/gtsam/nonlinear/Expression.h b/gtsam/nonlinear/Expression.h index c7f022724..f0c1751cf 100644 --- a/gtsam/nonlinear/Expression.h +++ b/gtsam/nonlinear/Expression.h @@ -206,11 +206,20 @@ private: // with an execution trace, made up entirely of "Record" structs, see // the FunctionalNode class in expression-inl.h size_t size = traceSize(); +#ifdef _MSC_VER + ExecutionTraceStorage* traceStorage = new ExecutionTraceStorage[size]; + ExecutionTrace trace; + T value(traceExecution(values, trace, traceStorage)); + trace.startReverseAD1(jacobians); + delete[] traceStorage; + return value; +#else ExecutionTraceStorage traceStorage[size]; ExecutionTrace trace; T value(traceExecution(values, trace, traceStorage)); trace.startReverseAD1(jacobians); return value; +#endif } // be very selective on who can access these private methods: diff --git a/gtsam_unstable/nonlinear/expressions.h b/gtsam_unstable/nonlinear/expressions.h index 2490100d6..5ac229b7a 100644 --- a/gtsam_unstable/nonlinear/expressions.h +++ b/gtsam_unstable/nonlinear/expressions.h @@ -8,13 +8,26 @@ #pragma once #include +#include +#include #include namespace gtsam { +// 2D Geometry + typedef Expression Pose2_; + + Pose2_ between(const Pose2_& x, const Pose2_& p) { + Pose2(Pose2::*transform)(const Pose2& p, + boost::optional H1, + boost::optional H2) const = &Pose2::between; + + return Pose2_(x, transform, p); + } + // Generics -template +template Expression between(const Expression& t1, const Expression& t2) { return Expression(t1, &T::between, t2); }