diff --git a/gtsam/base/concepts.h b/gtsam/base/concepts.h index 2cccd46cb..4fa1108c9 100644 --- a/gtsam/base/concepts.h +++ b/gtsam/base/concepts.h @@ -18,7 +18,7 @@ namespace gtsam { -template struct traits_x {}; + /** * @name Algebraic Structure Tags @@ -35,6 +35,19 @@ struct vector_space_tag: public lie_group_tag {}; struct multiplicative_group_tag {}; struct additive_group_tag {}; +// TODO: Remove +namespace traits { +template +struct dimension; +} +template struct traits_x { + // todo: remove anything in here ASAP. + // This is just here during development to avoid compilation + // errors while implmenting traits for everything. + enum { dimension = traits::dimension::value }; + typedef manifold_tag structure_category; +}; + namespace internal { diff --git a/gtsam/base/numericalDerivative.h b/gtsam/base/numericalDerivative.h index b2c163c2d..8e1989d53 100644 --- a/gtsam/base/numericalDerivative.h +++ b/gtsam/base/numericalDerivative.h @@ -28,6 +28,7 @@ #pragma GCC diagnostic pop #endif +#include #include #include #include @@ -110,12 +111,12 @@ Matrix numericalDerivative11(boost::function h, const X& x, double delta = 1e-5) { using namespace traits; - BOOST_STATIC_ASSERT_MSG(traits::is_manifold::value, + BOOST_STATIC_ASSERT_MSG( (typename boost::is_same< typename traits_x::structure_category, gtsam::manifold_tag>::value), "Template argument Y must be a manifold type."); typedef DefaultChart ChartY; typedef typename ChartY::vector TangentY; - BOOST_STATIC_ASSERT_MSG(traits::is_manifold::value, + BOOST_STATIC_ASSERT_MSG( (typename boost::is_same::structure_category, gtsam::manifold_tag>::value), "Template argument X must be a manifold type."); static const int N = traits::dimension::value; BOOST_STATIC_ASSERT_MSG(N>0, "Template argument X must be fixed-size type."); diff --git a/gtsam/nonlinear/Expression-inl.h b/gtsam/nonlinear/Expression-inl.h index d6dc5088d..b91bbd478 100644 --- a/gtsam/nonlinear/Expression-inl.h +++ b/gtsam/nonlinear/Expression-inl.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -143,7 +144,7 @@ void handleLeafCase(const Eigen::MatrixBase& dTdA, */ template class ExecutionTrace { - static const int Dim = traits::dimension::value; + static const int Dim = traits_x::dimension; enum { Constant, Leaf, Function } kind; @@ -624,7 +625,7 @@ struct FunctionalNode { /// Provide convenience access to Record storage and implement /// the virtual function based interface of CallRecord using the CallRecordImplementor struct Record: public internal::CallRecordImplementor::value>, public Base::Record { + traits_x::dimension>, public Base::Record { using Base::Record::print; using Base::Record::startReverseAD4; using Base::Record::reverseAD4;