From eb1e75fd27c72cc2ed42ae64c8fa1e05194ac20a Mon Sep 17 00:00:00 2001 From: Jing Dong Date: Thu, 18 May 2017 14:46:46 -0700 Subject: [PATCH] fixing vc++14 compile issues --- gtsam/base/deprecated/LieMatrix.h | 4 ++-- gtsam/base/deprecated/LieVector.h | 6 +++--- gtsam/geometry/Cal3_S2Stereo.h | 2 +- gtsam/geometry/Point2.h | 14 +++++++------- gtsam/geometry/SO3.h | 4 ++-- gtsam/geometry/tests/testCameraSet.cpp | 6 +++--- gtsam/geometry/tests/testOrientedPlane3.cpp | 2 -- 7 files changed, 18 insertions(+), 20 deletions(-) diff --git a/gtsam/base/deprecated/LieMatrix.h b/gtsam/base/deprecated/LieMatrix.h index e26f45511..9ee20a596 100644 --- a/gtsam/base/deprecated/LieMatrix.h +++ b/gtsam/base/deprecated/LieMatrix.h @@ -29,7 +29,7 @@ namespace gtsam { * we can directly add double, Vector, and Matrix into values now, because of * gtsam::traits. */ -struct LieMatrix : public Matrix { +struct GTSAM_EXPORT LieMatrix : public Matrix { /// @name Constructors /// @{ @@ -60,7 +60,7 @@ struct LieMatrix : public Matrix { /// @{ /** print @param s optional string naming the object */ - GTSAM_EXPORT void print(const std::string& name = "") const { + void print(const std::string& name = "") const { gtsam::print(matrix(), name); } /** equality up to tolerance */ diff --git a/gtsam/base/deprecated/LieVector.h b/gtsam/base/deprecated/LieVector.h index 4a85036e0..b271275c3 100644 --- a/gtsam/base/deprecated/LieVector.h +++ b/gtsam/base/deprecated/LieVector.h @@ -27,7 +27,7 @@ namespace gtsam { * we can directly add double, Vector, and Matrix into values now, because of * gtsam::traits. */ -struct LieVector : public Vector { +struct GTSAM_EXPORT LieVector : public Vector { enum { dimension = Eigen::Dynamic }; @@ -51,13 +51,13 @@ struct LieVector : public Vector { LieVector(double d) : Vector((Vector(1) << d).finished()) {} /** constructor with size and initial data, row order ! */ - GTSAM_EXPORT LieVector(size_t m, const double* const data) : Vector(m) { + LieVector(size_t m, const double* const data) : Vector(m) { for (size_t i = 0; i < m; i++) (*this)(i) = data[i]; } /// @name Testable /// @{ - GTSAM_EXPORT void print(const std::string& name="") const { + void print(const std::string& name="") const { gtsam::print(vector(), name); } bool equals(const LieVector& expected, double tol=1e-5) const { diff --git a/gtsam/geometry/Cal3_S2Stereo.h b/gtsam/geometry/Cal3_S2Stereo.h index db49448ec..3a0f56c30 100644 --- a/gtsam/geometry/Cal3_S2Stereo.h +++ b/gtsam/geometry/Cal3_S2Stereo.h @@ -27,7 +27,7 @@ namespace gtsam { * @addtogroup geometry * \nosubgrouping */ - class Cal3_S2Stereo { + class GTSAM_EXPORT Cal3_S2Stereo { private: Cal3_S2 K_; diff --git a/gtsam/geometry/Point2.h b/gtsam/geometry/Point2.h index fb250df6d..cfd7b4500 100644 --- a/gtsam/geometry/Point2.h +++ b/gtsam/geometry/Point2.h @@ -152,23 +152,23 @@ struct traits : public internal::VectorSpace { #endif // GTSAM_TYPEDEF_POINTS_TO_VECTORS /// Distance of the point from the origin, with Jacobian -double norm2(const Point2& p, OptionalJacobian<1, 2> H = boost::none); +GTSAM_EXPORT double norm2(const Point2& p, OptionalJacobian<1, 2> H = boost::none); /// distance between two points -double distance2(const Point2& p1, const Point2& q, +GTSAM_EXPORT double distance2(const Point2& p1, const Point2& q, OptionalJacobian<1, 2> H1 = boost::none, OptionalJacobian<1, 2> H2 = boost::none); // Convenience typedef typedef std::pair Point2Pair; -std::ostream &operator<<(std::ostream &os, const gtsam::Point2Pair &p); +GTSAM_EXPORT std::ostream &operator<<(std::ostream &os, const gtsam::Point2Pair &p); // For MATLAB wrapper typedef std::vector Point2Vector; /// multiply with scalar inline Point2 operator*(double s, const Point2& p) { -return p * s; + return p * s; } /* @@ -185,7 +185,7 @@ return p * s; * @param tol: absolute tolerance below which we consider touching circles * @return optional Point2 with f and h, boost::none if no solution. */ -boost::optional circleCircleIntersection(double R_d, double r_d, double tol = 1e-9); +GTSAM_EXPORT boost::optional circleCircleIntersection(double R_d, double r_d, double tol = 1e-9); /* * @brief Circle-circle intersection, from the normalized radii solution. @@ -193,7 +193,7 @@ boost::optional circleCircleIntersection(double R_d, double r_d, double * @param c2 center of second circle * @return list of solutions (0,1, or 2). Identical circles will return empty list, as well. */ -std::list circleCircleIntersection(Point2 c1, Point2 c2, boost::optional fh); +GTSAM_EXPORT std::list circleCircleIntersection(Point2 c1, Point2 c2, boost::optional fh); /** * @brief Intersect 2 circles @@ -204,7 +204,7 @@ std::list circleCircleIntersection(Point2 c1, Point2 c2, boost::optional * @param tol: absolute tolerance below which we consider touching circles * @return list of solutions (0,1, or 2). Identical circles will return empty list, as well. */ -std::list circleCircleIntersection(Point2 c1, double r1, +GTSAM_EXPORT std::list circleCircleIntersection(Point2 c1, double r1, Point2 c2, double r2, double tol = 1e-9); } // \ namespace gtsam diff --git a/gtsam/geometry/SO3.h b/gtsam/geometry/SO3.h index 53f2c2130..e9d257acb 100644 --- a/gtsam/geometry/SO3.h +++ b/gtsam/geometry/SO3.h @@ -135,7 +135,7 @@ public: namespace so3 { /// Functor implementing Exponential map -class ExpmapFunctor { +class GTSAM_EXPORT ExpmapFunctor { protected: const double theta2; Matrix3 W, K, KK; @@ -156,7 +156,7 @@ class ExpmapFunctor { }; /// Functor that implements Exponential map *and* its derivatives -class DexpFunctor : public ExpmapFunctor { +class GTSAM_EXPORT DexpFunctor : public ExpmapFunctor { const Vector3 omega; double a, b; Matrix3 dexp_; diff --git a/gtsam/geometry/tests/testCameraSet.cpp b/gtsam/geometry/tests/testCameraSet.cpp index 01f784ae0..de7fe4625 100644 --- a/gtsam/geometry/tests/testCameraSet.cpp +++ b/gtsam/geometry/tests/testCameraSet.cpp @@ -89,7 +89,7 @@ TEST(CameraSet, Pinhole) { Vector4 b = actualV; Vector v = Ft * (b - E * P * Et * b); schur << Ft * F - Ft * E * P * Et * F, v, v.transpose(), 30; - SymmetricBlockMatrix actualReduced = Set::SchurComplement(Fs, E, P, b); + SymmetricBlockMatrix actualReduced = Set::SchurComplement<3>(Fs, E, P, b); EXPECT(assert_equal(schur, actualReduced.selfadjointView())); // Check Schur complement update, same order, should just double @@ -98,14 +98,14 @@ TEST(CameraSet, Pinhole) { allKeys.push_back(2); keys.push_back(1); keys.push_back(2); - Set::UpdateSchurComplement(Fs, E, P, b, allKeys, keys, actualReduced); + Set::UpdateSchurComplement<3>(Fs, E, P, b, allKeys, keys, actualReduced); EXPECT(assert_equal((Matrix )(2.0 * schur), actualReduced.selfadjointView())); // Check Schur complement update, keys reversed FastVector keys2; keys2.push_back(2); keys2.push_back(1); - Set::UpdateSchurComplement(Fs, E, P, b, allKeys, keys2, actualReduced); + Set::UpdateSchurComplement<3>(Fs, E, P, b, allKeys, keys2, actualReduced); Vector4 reverse_b; reverse_b << b.tail<2>(), b.head<2>(); Vector reverse_v = Ft * (reverse_b - E * P * Et * reverse_b); diff --git a/gtsam/geometry/tests/testOrientedPlane3.cpp b/gtsam/geometry/tests/testOrientedPlane3.cpp index b3d87f18c..a1531e07c 100644 --- a/gtsam/geometry/tests/testOrientedPlane3.cpp +++ b/gtsam/geometry/tests/testOrientedPlane3.cpp @@ -120,8 +120,6 @@ TEST(OrientedPlane3, localCoordinates_retract) { maxXiLimit << M_PI, M_PI, 10.0; for (size_t i = 0; i < numIterations; i++) { - sleep(0); - // Create a Plane OrientedPlane3 p1(randomVector(minPlaneLimit, maxPlaneLimit)); Vector v12 = randomVector(minXiLimit, maxXiLimit);