diff --git a/CMakeLists.txt b/CMakeLists.txt index 004ded5e4..9ef48a56e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,11 @@ else() endif() +if(${Boost_VERSION} EQUAL 105600) + message("Ignoring Boost restriction on optional lvalue assignment from rvalues") + add_definitions(-DBOOST_OPTIONAL_ALLOW_BINDING_TO_RVALUES) +endif() + ############################################################################### # Find TBB find_package(TBB) diff --git a/gtsam/base/DerivedValue.h b/gtsam/base/DerivedValue.h index 49528a126..78155d308 100644 --- a/gtsam/base/DerivedValue.h +++ b/gtsam/base/DerivedValue.h @@ -16,8 +16,9 @@ */ #pragma once -#include + #include +#include ////////////////// // The following includes windows.h in some MSVC versions, so we undef min, max, and ERROR diff --git a/gtsam/base/LieMatrix.h b/gtsam/base/LieMatrix.h index 8d43dd6ea..23e5fd023 100644 --- a/gtsam/base/LieMatrix.h +++ b/gtsam/base/LieMatrix.h @@ -19,9 +19,9 @@ #include +#include #include #include -#include #include namespace gtsam { @@ -40,9 +40,12 @@ struct LieMatrix : public Matrix, public DerivedValue { /** initialize from a normal matrix */ LieMatrix(const Matrix& v) : Matrix(v) {} +// Currently TMP constructor causes ICE on MSVS 2013 +#if (_MSC_VER < 1800) /** initialize from a fixed size normal vector */ template LieMatrix(const Eigen::Matrix& v) : Matrix(v) {} +#endif /** constructor with size and initial data, row order ! */ LieMatrix(size_t m, size_t n, const double* const data) : @@ -82,6 +85,7 @@ struct LieMatrix : public Matrix, public DerivedValue { inline LieMatrix retract(const Vector& v) const { if(v.size() != this->size()) throw std::invalid_argument("LieMatrix::retract called with Vector of incorrect size"); + return LieMatrix(*this + Eigen::Map >( &v(0), this->rows(), this->cols())); diff --git a/gtsam/base/LieVector.h b/gtsam/base/LieVector.h index 6989bbfd2..a8bfe3007 100644 --- a/gtsam/base/LieVector.h +++ b/gtsam/base/LieVector.h @@ -33,10 +33,13 @@ struct LieVector : public Vector, public DerivedValue { /** initialize from a normal vector */ LieVector(const Vector& v) : Vector(v) {} - + +// Currently TMP constructor causes ICE on MSVS 2013 +#if (_MSC_VER < 1800) /** initialize from a fixed size normal vector */ template LieVector(const Eigen::Matrix& v) : Vector(v) {} +#endif /** wrap a double */ LieVector(double d) : Vector((Vector(1) << d)) {} diff --git a/gtsam/base/Matrix.h b/gtsam/base/Matrix.h index 6386bd526..16884f4c1 100644 --- a/gtsam/base/Matrix.h +++ b/gtsam/base/Matrix.h @@ -467,7 +467,7 @@ GTSAM_EXPORT Matrix Cayley(const Matrix& A); /// Implementation of Cayley transform using fixed size matrices to let /// Eigen do more optimization template -Eigen::Matrix Cayley(const Eigen::Matrix& A) { +Eigen::Matrix CayleyFixed(const Eigen::Matrix& A) { typedef Eigen::Matrix FMat; return (FMat::Identity() - A)*(FMat::Identity() + A).inverse(); } diff --git a/gtsam/geometry/Rot3M.cpp b/gtsam/geometry/Rot3M.cpp index 6257d8400..118d8546e 100644 --- a/gtsam/geometry/Rot3M.cpp +++ b/gtsam/geometry/Rot3M.cpp @@ -240,7 +240,7 @@ Rot3 Rot3::retract(const Vector& omega, Rot3::CoordinatesMode mode) const { return retractCayley(omega); } else if(mode == Rot3::SLOW_CAYLEY) { Matrix Omega = skewSymmetric(omega); - return (*this)*Cayley<3>(-Omega/2); + return (*this)*CayleyFixed<3>(-Omega/2); } else { assert(false); exit(1); @@ -269,7 +269,7 @@ Vector3 Rot3::localCoordinates(const Rot3& T, Rot3::CoordinatesMode mode) const // Create a fixed-size matrix Eigen::Matrix3d A(between(T).matrix()); // using templated version of Cayley - Eigen::Matrix3d Omega = Cayley<3>(A); + Eigen::Matrix3d Omega = CayleyFixed<3>(A); return -2*Vector3(Omega(2,1),Omega(0,2),Omega(1,0)); } else { assert(false); diff --git a/gtsam/nonlinear/LinearContainerFactor.h b/gtsam/nonlinear/LinearContainerFactor.h index d1420d029..340f3f6bc 100644 --- a/gtsam/nonlinear/LinearContainerFactor.h +++ b/gtsam/nonlinear/LinearContainerFactor.h @@ -117,7 +117,7 @@ public: // casting syntactic sugar - inline bool hasLinearizationPoint() const { return linearizationPoint_; } + inline bool hasLinearizationPoint() const { return linearizationPoint_.is_initialized(); } /** * Simple checks whether this is a Jacobian or Hessian factor diff --git a/gtsam/symbolic/tests/testSymbolicBayesTree.cpp b/gtsam/symbolic/tests/testSymbolicBayesTree.cpp index c021c7fae..3c02f6dbd 100644 --- a/gtsam/symbolic/tests/testSymbolicBayesTree.cpp +++ b/gtsam/symbolic/tests/testSymbolicBayesTree.cpp @@ -251,7 +251,7 @@ TEST( BayesTree, shortcutCheck ) // Check if all the cached shortcuts are cleared rootClique->deleteCachedShortcuts(); BOOST_FOREACH(SymbolicBayesTree::sharedClique& clique, allCliques) { - bool notCleared = clique->cachedSeparatorMarginal(); + bool notCleared = clique->cachedSeparatorMarginal().is_initialized(); CHECK( notCleared == false); } EXPECT_LONGS_EQUAL(0, (long)rootClique->numCachedSeparatorMarginals());