commit
2d231edd1b
|
@ -561,8 +561,8 @@ struct GenerateFunctionalNode: Argument<T, A, Base::N + 1>, Base {
|
||||||
|
|
||||||
/// Given df/dT, multiply in dT/dA and continue reverse AD process
|
/// Given df/dT, multiply in dT/dA and continue reverse AD process
|
||||||
// Cols is always known at compile time
|
// Cols is always known at compile time
|
||||||
template<int Rows, int Cols>
|
template<typename SomeMatrix>
|
||||||
void reverseAD4(const Eigen::Matrix<double, Rows, Cols> & dFdT,
|
void reverseAD4(const SomeMatrix & dFdT,
|
||||||
JacobianMap& jacobians) const {
|
JacobianMap& jacobians) const {
|
||||||
Base::Record::reverseAD4(dFdT, jacobians);
|
Base::Record::reverseAD4(dFdT, jacobians);
|
||||||
This::trace.reverseAD1(dFdT * This::dTdA, jacobians);
|
This::trace.reverseAD1(dFdT * This::dTdA, jacobians);
|
||||||
|
|
|
@ -206,10 +206,24 @@ private:
|
||||||
// with an execution trace, made up entirely of "Record" structs, see
|
// with an execution trace, made up entirely of "Record" structs, see
|
||||||
// the FunctionalNode class in expression-inl.h
|
// the FunctionalNode class in expression-inl.h
|
||||||
size_t size = traceSize();
|
size_t size = traceSize();
|
||||||
|
|
||||||
|
// Windows does not support variable length arrays, so memory must be dynamically
|
||||||
|
// allocated on Visual Studio. For more information see the issue below
|
||||||
|
// https://bitbucket.org/gtborg/gtsam/issue/178/vlas-unsupported-in-visual-studio
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
ExecutionTraceStorage* traceStorage = new ExecutionTraceStorage[size];
|
||||||
|
#else
|
||||||
ExecutionTraceStorage traceStorage[size];
|
ExecutionTraceStorage traceStorage[size];
|
||||||
|
#endif
|
||||||
|
|
||||||
ExecutionTrace<T> trace;
|
ExecutionTrace<T> trace;
|
||||||
T value(traceExecution(values, trace, traceStorage));
|
T value(traceExecution(values, trace, traceStorage));
|
||||||
trace.startReverseAD1(jacobians);
|
trace.startReverseAD1(jacobians);
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
delete[] traceStorage;
|
||||||
|
#endif
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
// Generics
|
// Generics
|
||||||
|
template<typename T>
|
||||||
template<class T>
|
|
||||||
Expression<T> between(const Expression<T>& t1, const Expression<T>& t2) {
|
Expression<T> between(const Expression<T>& t1, const Expression<T>& t2) {
|
||||||
return Expression<T>(t1, &T::between, t2);
|
return Expression<T>(t1, &T::between, t2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,7 @@ typedef Expression<Rot2> Rot2_;
|
||||||
typedef Expression<Pose2> Pose2_;
|
typedef Expression<Pose2> Pose2_;
|
||||||
|
|
||||||
Point2_ transform_to(const Pose2_& x, const Point2_& p) {
|
Point2_ transform_to(const Pose2_& x, const Point2_& p) {
|
||||||
Point2 (Pose2::*transform)(const Point2& p, OptionalJacobian<2, 3> H1,
|
return Point2_(x, &Pose2::transform_to, p);
|
||||||
OptionalJacobian<2, 2> H2) const = &Pose2::transform_to;
|
|
||||||
|
|
||||||
return Point2_(x, transform, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3D Geometry
|
// 3D Geometry
|
||||||
|
@ -33,11 +30,7 @@ typedef Expression<Rot3> Rot3_;
|
||||||
typedef Expression<Pose3> Pose3_;
|
typedef Expression<Pose3> Pose3_;
|
||||||
|
|
||||||
Point3_ transform_to(const Pose3_& x, const Point3_& p) {
|
Point3_ transform_to(const Pose3_& x, const Point3_& p) {
|
||||||
|
return Point3_(x, &Pose3::transform_to, p);
|
||||||
Point3 (Pose3::*transform)(const Point3& p, OptionalJacobian<3, 6> Dpose,
|
|
||||||
OptionalJacobian<3, 3> Dpoint) const = &Pose3::transform_to;
|
|
||||||
|
|
||||||
return Point3_(x, transform, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Projection
|
// Projection
|
||||||
|
|
Loading…
Reference in New Issue