From c2c9c4a982bccf1d233f81c5c7151ae24a31a777 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 23 May 2012 18:51:49 +0000 Subject: [PATCH] Almost everything compiles and passes in windows --- examples/PlanarSLAMExample_easy.cpp | 2 +- gtsam/base/tests/testVector.cpp | 2 +- gtsam/discrete/DecisionTree-inl.h | 2 +- gtsam/geometry/tests/testCalibratedCamera.cpp | 2 +- gtsam/geometry/tests/testFundamental.cpp | 8 +- gtsam/geometry/tests/testHomography2.cpp | 18 ++--- gtsam/geometry/tests/testPoint2.cpp | 4 +- gtsam/geometry/tests/testPose2.cpp | 74 +++++++++---------- gtsam/geometry/tests/testPose3.cpp | 12 +-- gtsam/geometry/tests/testRot2.cpp | 8 +- gtsam/geometry/tests/testRot3M.cpp | 2 +- gtsam/geometry/tests/testSimpleCamera.cpp | 2 +- gtsam/geometry/tests/testTensors.cpp | 12 +-- gtsam/inference/graph-inl.h | 4 +- gtsam/slam/tests/testGeneralSFMFactor.cpp | 4 +- .../testGeneralSFMFactor_Cal3Bundler.cpp | 4 +- gtsam/slam/tests/testPlanarSLAM.cpp | 16 ++-- gtsam/slam/tests/testPose2SLAM.cpp | 32 ++++---- tests/testDoglegOptimizer.cpp | 5 +- tests/testGaussianFactor.cpp | 4 +- tests/testGaussianFactorGraphB.cpp | 4 +- tests/testGraph.cpp | 2 +- tests/testInferenceB.cpp | 2 +- tests/testMarginals.cpp | 2 +- 24 files changed, 113 insertions(+), 114 deletions(-) diff --git a/examples/PlanarSLAMExample_easy.cpp b/examples/PlanarSLAMExample_easy.cpp index 5039b1145..808de3ba3 100644 --- a/examples/PlanarSLAMExample_easy.cpp +++ b/examples/PlanarSLAMExample_easy.cpp @@ -53,7 +53,7 @@ int main(int argc, char** argv) { Rot2 bearing11 = Rot2::fromDegrees(45), bearing21 = Rot2::fromDegrees(90), bearing32 = Rot2::fromDegrees(90); - double range11 = sqrt(4+4), + double range11 = std::sqrt(4.0+4.0), range21 = 2.0, range32 = 2.0; diff --git a/gtsam/base/tests/testVector.cpp b/gtsam/base/tests/testVector.cpp index 8b8757027..6657d41f9 100644 --- a/gtsam/base/tests/testVector.cpp +++ b/gtsam/base/tests/testVector.cpp @@ -251,7 +251,7 @@ TEST( TestVector, axpy ) /* ************************************************************************* */ TEST( TestVector, equals ) { - Vector v1 = Vector_(1, 0.0/0.0); //testing nan + Vector v1 = Vector_(1, 0.0/std::numeric_limits::quiet_NaN()); //testing nan Vector v2 = Vector_(1, 1.0); double tol = 1.; EXPECT(!equal_with_abs_tol(v1, v2, tol)); diff --git a/gtsam/discrete/DecisionTree-inl.h b/gtsam/discrete/DecisionTree-inl.h index 1fa750ace..a9953d506 100644 --- a/gtsam/discrete/DecisionTree-inl.h +++ b/gtsam/discrete/DecisionTree-inl.h @@ -81,7 +81,7 @@ namespace gtsam { bool equals(const Node& q, double tol) const { const Leaf* other = dynamic_cast (&q); if (!other) return false; - return fabs(this->constant_ - other->constant_) < tol; + return fabs(double(this->constant_ - other->constant_)) < tol; } /** print */ diff --git a/gtsam/geometry/tests/testCalibratedCamera.cpp b/gtsam/geometry/tests/testCalibratedCamera.cpp index 5bb1ebe65..7fe88bce0 100644 --- a/gtsam/geometry/tests/testCalibratedCamera.cpp +++ b/gtsam/geometry/tests/testCalibratedCamera.cpp @@ -65,7 +65,7 @@ TEST( CalibratedCamera, level1) TEST( CalibratedCamera, level2) { // Create a level camera, looking in Y-direction - Pose2 pose2(0.4,0.3,M_PI_2); + Pose2 pose2(0.4,0.3,M_PI/2.0); CalibratedCamera camera = CalibratedCamera::level(pose2, 0.1); // expected diff --git a/gtsam/geometry/tests/testFundamental.cpp b/gtsam/geometry/tests/testFundamental.cpp index 297b36036..46a051609 100644 --- a/gtsam/geometry/tests/testFundamental.cpp +++ b/gtsam/geometry/tests/testFundamental.cpp @@ -34,11 +34,11 @@ using namespace tensors; /* ************************************************************************* */ // Indices -Index<3, 'a'> a; -Index<3, 'b'> b; +tensors::Index<3, 'a'> a; +tensors::Index<3, 'b'> b; -Index<4, 'A'> A; -Index<4, 'B'> B; +tensors::Index<4, 'A'> A; +tensors::Index<4, 'B'> B; /* ************************************************************************* */ TEST( Tensors, FundamentalMatrix) diff --git a/gtsam/geometry/tests/testHomography2.cpp b/gtsam/geometry/tests/testHomography2.cpp index 417d41977..062de9d1d 100644 --- a/gtsam/geometry/tests/testHomography2.cpp +++ b/gtsam/geometry/tests/testHomography2.cpp @@ -36,9 +36,9 @@ using namespace tensors; /* ************************************************************************* */ // Indices -Index<3, 'a'> a, _a; -Index<3, 'b'> b, _b; -Index<3, 'c'> c, _c; +tensors::Index<3, 'a'> a, _a; +tensors::Index<3, 'b'> b, _b; +tensors::Index<3, 'c'> c, _c; /* ************************************************************************* */ TEST( Homography2, RealImages) @@ -120,8 +120,8 @@ Homography2 patchH(const Pose3& tEc) { namespace gtsam { // size_t dim(const tensors::Tensor2<3, 3>& H) {return 9;} Vector toVector(const tensors::Tensor2<3, 3>& H) { - Index<3, 'T'> _T; // covariant 2D template - Index<3, 'C'> I; // contravariant 2D camera + tensors::Index<3, 'T'> _T; // covariant 2D template + tensors::Index<3, 'C'> I; // contravariant 2D camera return toVector(H(I,_T)); } Vector localCoordinates(const tensors::Tensor2<3, 3>& A, const tensors::Tensor2<3, 3>& B) { @@ -134,8 +134,8 @@ namespace gtsam { /* ************************************************************************* */ TEST( Homography2, patchH) { - Index<3, 'T'> _T; // covariant 2D template - Index<3, 'C'> I; // contravariant 2D camera + tensors::Index<3, 'T'> _T; // covariant 2D template + tensors::Index<3, 'C'> I; // contravariant 2D camera // data[_T][I] double data1[3][3] = {{1,0,0},{0,-1,0},{0,0,10}}; @@ -160,8 +160,8 @@ TEST( Homography2, patchH) /* ************************************************************************* */ TEST( Homography2, patchH2) { - Index<3, 'T'> _T; // covariant 2D template - Index<3, 'C'> I; // contravariant 2D camera + tensors::Index<3, 'T'> _T; // covariant 2D template + tensors::Index<3, 'C'> I; // contravariant 2D camera // data[_T][I] double data1[3][3] = {{1,0,0},{0,-1,0},{0,0,10}}; diff --git a/gtsam/geometry/tests/testPoint2.cpp b/gtsam/geometry/tests/testPoint2.cpp index 3416361cd..f7fee0418 100644 --- a/gtsam/geometry/tests/testPoint2.cpp +++ b/gtsam/geometry/tests/testPoint2.cpp @@ -72,7 +72,7 @@ TEST( Point2, arithmetic) /* ************************************************************************* */ TEST( Point2, norm) { - Point2 p0(cos(5), sin(5)); + Point2 p0(cos(5.0), sin(5.0)); DOUBLES_EQUAL(1,p0.norm(),1e-6); Point2 p1(4, 5), p2(1, 1); DOUBLES_EQUAL( 5,p1.dist(p2),1e-6); @@ -85,7 +85,7 @@ TEST( Point2, unit) Point2 p0(10.0, 0.0), p1(0.0,-10.0), p2(10.0, 10.0); EXPECT(assert_equal(Point2(1.0, 0.0), p0.unit(), 1e-6)); EXPECT(assert_equal(Point2(0.0,-1.0), p1.unit(), 1e-6)); - EXPECT(assert_equal(Point2(sqrt(2)/2.0, sqrt(2)/2.0), p2.unit(), 1e-6)); + EXPECT(assert_equal(Point2(sqrt(2.0)/2.0, sqrt(2.0)/2.0), p2.unit(), 1e-6)); } /* ************************************************************************* */ diff --git a/gtsam/geometry/tests/testPose2.cpp b/gtsam/geometry/tests/testPose2.cpp index 14e529613..cdde3cd54 100644 --- a/gtsam/geometry/tests/testPose2.cpp +++ b/gtsam/geometry/tests/testPose2.cpp @@ -44,14 +44,14 @@ TEST(Pose2, constructors) { Pose2 pose(0,p); Pose2 origin; assert_equal(pose,origin); - Pose2 t(M_PI_2+0.018, Point2(1.015, 2.01)); + Pose2 t(M_PI/2.0+0.018, Point2(1.015, 2.01)); EXPECT(assert_equal(t,Pose2(t.matrix()))); } /* ************************************************************************* */ TEST(Pose2, manifold) { - Pose2 t1(M_PI_2, Point2(1, 2)); - Pose2 t2(M_PI_2+0.018, Point2(1.015, 2.01)); + Pose2 t1(M_PI/2.0, Point2(1, 2)); + Pose2 t2(M_PI/2.0+0.018, Point2(1.015, 2.01)); Pose2 origin; Vector d12 = t1.localCoordinates(t2); EXPECT(assert_equal(t2, t1.retract(d12))); @@ -63,11 +63,11 @@ TEST(Pose2, manifold) { /* ************************************************************************* */ TEST(Pose2, retract) { - Pose2 pose(M_PI_2, Point2(1, 2)); + Pose2 pose(M_PI/2.0, Point2(1, 2)); #ifdef SLOW_BUT_CORRECT_EXPMAP Pose2 expected(1.00811, 2.01528, 2.5608); #else - Pose2 expected(M_PI_2+0.99, Point2(1.015, 2.01)); + Pose2 expected(M_PI/2.0+0.99, Point2(1.015, 2.01)); #endif Pose2 actual = pose.retract(Vector_(3, 0.01, -0.015, 0.99)); EXPECT(assert_equal(expected, actual, 1e-5)); @@ -75,7 +75,7 @@ TEST(Pose2, retract) { /* ************************************************************************* */ TEST(Pose2, expmap) { - Pose2 pose(M_PI_2, Point2(1, 2)); + Pose2 pose(M_PI/2.0, Point2(1, 2)); Pose2 expected(1.00811, 2.01528, 2.5608); Pose2 actual = expmap_default(pose, Vector_(3, 0.01, -0.015, 0.99)); EXPECT(assert_equal(expected, actual, 1e-5)); @@ -83,7 +83,7 @@ TEST(Pose2, expmap) { /* ************************************************************************* */ TEST(Pose2, expmap2) { - Pose2 pose(M_PI_2, Point2(1, 2)); + Pose2 pose(M_PI/2.0, Point2(1, 2)); Pose2 expected(1.00811, 2.01528, 2.5608); Pose2 actual = expmap_default(pose, Vector_(3, 0.01, -0.015, 0.99)); EXPECT(assert_equal(expected, actual, 1e-5)); @@ -110,11 +110,11 @@ TEST(Pose2, expmap3) { /* ************************************************************************* */ TEST(Pose2, expmap0) { - Pose2 pose(M_PI_2, Point2(1, 2)); + Pose2 pose(M_PI/2.0, Point2(1, 2)); //#ifdef SLOW_BUT_CORRECT_EXPMAP Pose2 expected(1.01491, 2.01013, 1.5888); //#else -// Pose2 expected(M_PI_2+0.018, Point2(1.015, 2.01)); +// Pose2 expected(M_PI/2.0+0.018, Point2(1.015, 2.01)); //#endif Pose2 actual = pose * (Pose2::Expmap(Vector_(3, 0.01, -0.015, 0.018))); EXPECT(assert_equal(expected, actual, 1e-5)); @@ -122,7 +122,7 @@ TEST(Pose2, expmap0) { /* ************************************************************************* */ TEST(Pose2, expmap0_full) { - Pose2 pose(M_PI_2, Point2(1, 2)); + Pose2 pose(M_PI/2.0, Point2(1, 2)); Pose2 expected(1.01491, 2.01013, 1.5888); Pose2 actual = pose * Pose2::Expmap(Vector_(3, 0.01, -0.015, 0.018)); EXPECT(assert_equal(expected, actual, 1e-5)); @@ -130,7 +130,7 @@ TEST(Pose2, expmap0_full) { /* ************************************************************************* */ TEST(Pose2, expmap0_full2) { - Pose2 pose(M_PI_2, Point2(1, 2)); + Pose2 pose(M_PI/2.0, Point2(1, 2)); Pose2 expected(1.01491, 2.01013, 1.5888); Pose2 actual = pose * Pose2::Expmap(Vector_(3, 0.01, -0.015, 0.018)); EXPECT(assert_equal(expected, actual, 1e-5)); @@ -170,8 +170,8 @@ TEST(Pose3, expmap_c_full) /* ************************************************************************* */ TEST(Pose2, logmap) { - Pose2 pose0(M_PI_2, Point2(1, 2)); - Pose2 pose(M_PI_2+0.018, Point2(1.015, 2.01)); + Pose2 pose0(M_PI/2.0, Point2(1, 2)); + Pose2 pose(M_PI/2.0+0.018, Point2(1.015, 2.01)); #ifdef SLOW_BUT_CORRECT_EXPMAP Vector expected = Vector_(3, 0.00986473, -0.0150896, 0.018); #else @@ -183,8 +183,8 @@ TEST(Pose2, logmap) { /* ************************************************************************* */ TEST(Pose2, logmap_full) { - Pose2 pose0(M_PI_2, Point2(1, 2)); - Pose2 pose(M_PI_2+0.018, Point2(1.015, 2.01)); + Pose2 pose0(M_PI/2.0, Point2(1, 2)); + Pose2 pose(M_PI/2.0+0.018, Point2(1.015, 2.01)); Vector expected = Vector_(3, 0.00986473, -0.0150896, 0.018); Vector actual = logmap_default(pose0, pose); EXPECT(assert_equal(expected, actual, 1e-5)); @@ -197,7 +197,7 @@ Point2 transform_to_proxy(const Pose2& pose, const Point2& point) { TEST( Pose2, transform_to ) { - Pose2 pose(M_PI_2, Point2(1,2)); // robot at (1,2) looking towards y + Pose2 pose(M_PI/2.0, Point2(1,2)); // robot at (1,2) looking towards y Point2 point(-1,4); // landmark at (-1,4) // expected @@ -226,7 +226,7 @@ Point2 transform_from_proxy(const Pose2& pose, const Point2& point) { TEST (Pose2, transform_from) { - Pose2 pose(1., 0., M_PI_2); + Pose2 pose(1., 0., M_PI/2.0); Point2 pt(2., 1.); Matrix H1, H2; Point2 actual = pose.transform_from(pt, H1, H2); @@ -326,7 +326,7 @@ TEST(Pose2, compose_c) TEST(Pose2, inverse ) { Point2 origin, t(1,2); - Pose2 gTl(M_PI_2, t); // robot at (1,2) looking towards y + Pose2 gTl(M_PI/2.0, t); // robot at (1,2) looking towards y Pose2 identity, lTg = gTl.inverse(); EXPECT(assert_equal(identity,lTg.compose(gTl))); @@ -362,7 +362,7 @@ Matrix matrix(const Pose2& gTl) { TEST( Pose2, matrix ) { Point2 origin, t(1,2); - Pose2 gTl(M_PI_2, t); // robot at (1,2) looking towards y + Pose2 gTl(M_PI/2.0, t); // robot at (1,2) looking towards y Matrix gMl = matrix(gTl); EXPECT(assert_equal(Matrix_(3,3, 0.0, -1.0, 1.0, @@ -393,7 +393,7 @@ TEST( Pose2, matrix ) /* ************************************************************************* */ TEST( Pose2, compose_matrix ) { - Pose2 gT1(M_PI_2, Point2(1,2)); // robot at (1,2) looking towards y + Pose2 gT1(M_PI/2.0, Point2(1,2)); // robot at (1,2) looking towards y Pose2 _1T2(M_PI, Point2(-1,4)); // local robot at (-1,4) loooking at negative x Matrix gM1(matrix(gT1)),_1M2(matrix(_1T2)); EXPECT(assert_equal(gM1*_1M2,matrix(gT1.compose(_1T2)))); // RIGHT DOES NOT @@ -407,11 +407,11 @@ TEST( Pose2, between ) // ^ // // *--0--*--* - Pose2 gT1(M_PI_2, Point2(1,2)); // robot at (1,2) looking towards y + Pose2 gT1(M_PI/2.0, Point2(1,2)); // robot at (1,2) looking towards y Pose2 gT2(M_PI, Point2(-1,4)); // robot at (-1,4) loooking at negative x Matrix actualH1,actualH2; - Pose2 expected(M_PI_2, Point2(2,2)); + Pose2 expected(M_PI/2.0, Point2(2,2)); Pose2 actual1 = gT1.between(gT2); Pose2 actual2 = gT1.between(gT2,actualH1,actualH2); EXPECT(assert_equal(expected,actual1)); @@ -443,7 +443,7 @@ TEST( Pose2, between ) // reverse situation for extra test TEST( Pose2, between2 ) { - Pose2 p2(M_PI_2, Point2(1,2)); // robot at (1,2) looking towards y + Pose2 p2(M_PI/2.0, Point2(1,2)); // robot at (1,2) looking towards y Pose2 p1(M_PI, Point2(-1,4)); // robot at (-1,4) loooking at negative x Matrix actualH1,actualH2; @@ -472,7 +472,7 @@ TEST(Pose2, members) /* ************************************************************************* */ // some shared test values -Pose2 x1, x2(1, 1, 0), x3(1, 1, M_PI_4); +Pose2 x1, x2(1, 1, 0), x3(1, 1, M_PI/4.0); Point2 l1(1, 0), l2(1, 1), l3(2, 2), l4(1, 3); /* ************************************************************************* */ @@ -488,11 +488,11 @@ TEST( Pose2, bearing ) EXPECT(assert_equal(Rot2(),x1.bearing(l1))); // establish bearing is indeed 45 degrees - EXPECT(assert_equal(Rot2::fromAngle(M_PI_4),x1.bearing(l2))); + EXPECT(assert_equal(Rot2::fromAngle(M_PI/4.0),x1.bearing(l2))); // establish bearing is indeed 45 degrees even if shifted Rot2 actual23 = x2.bearing(l3, actualH1, actualH2); - EXPECT(assert_equal(Rot2::fromAngle(M_PI_4),actual23)); + EXPECT(assert_equal(Rot2::fromAngle(M_PI/4.0),actual23)); // Check numerical derivatives expectedH1 = numericalDerivative21(bearing_proxy, x2, l3); @@ -502,7 +502,7 @@ TEST( Pose2, bearing ) // establish bearing is indeed 45 degrees even if rotated Rot2 actual34 = x3.bearing(l4, actualH1, actualH2); - EXPECT(assert_equal(Rot2::fromAngle(M_PI_4),actual34)); + EXPECT(assert_equal(Rot2::fromAngle(M_PI/4.0),actual34)); // Check numerical derivatives expectedH1 = numericalDerivative21(bearing_proxy, x3, l4); @@ -518,7 +518,7 @@ Rot2 bearing_pose_proxy(const Pose2& pose, const Pose2& pt) { TEST( Pose2, bearing_pose ) { - Pose2 xl1(1, 0, M_PI_2), xl2(1, 1, M_PI), xl3(2.0, 2.0,-M_PI_2), xl4(1, 3, 0); + Pose2 xl1(1, 0, M_PI/2.0), xl2(1, 1, M_PI), xl3(2.0, 2.0,-M_PI/2.0), xl4(1, 3, 0); Matrix expectedH1, actualH1, expectedH2, actualH2; @@ -526,11 +526,11 @@ TEST( Pose2, bearing_pose ) EXPECT(assert_equal(Rot2(),x1.bearing(xl1))); // establish bearing is indeed 45 degrees - EXPECT(assert_equal(Rot2::fromAngle(M_PI_4),x1.bearing(xl2))); + EXPECT(assert_equal(Rot2::fromAngle(M_PI/4.0),x1.bearing(xl2))); // establish bearing is indeed 45 degrees even if shifted Rot2 actual23 = x2.bearing(xl3, actualH1, actualH2); - EXPECT(assert_equal(Rot2::fromAngle(M_PI_4),actual23)); + EXPECT(assert_equal(Rot2::fromAngle(M_PI/4.0),actual23)); // Check numerical derivatives expectedH1 = numericalDerivative21(bearing_pose_proxy, x2, xl3); @@ -540,7 +540,7 @@ TEST( Pose2, bearing_pose ) // establish bearing is indeed 45 degrees even if rotated Rot2 actual34 = x3.bearing(xl4, actualH1, actualH2); - EXPECT(assert_equal(Rot2::fromAngle(M_PI_4),actual34)); + EXPECT(assert_equal(Rot2::fromAngle(M_PI/4.0),actual34)); // Check numerical derivatives expectedH1 = numericalDerivative21(bearing_pose_proxy, x3, xl4); @@ -561,11 +561,11 @@ TEST( Pose2, range ) EXPECT_DOUBLES_EQUAL(1,x1.range(l1),1e-9); // establish range is indeed 45 degrees - EXPECT_DOUBLES_EQUAL(sqrt(2),x1.range(l2),1e-9); + EXPECT_DOUBLES_EQUAL(sqrt(2.0),x1.range(l2),1e-9); // Another pair double actual23 = x2.range(l3, actualH1, actualH2); - EXPECT_DOUBLES_EQUAL(sqrt(2),actual23,1e-9); + EXPECT_DOUBLES_EQUAL(sqrt(2.0),actual23,1e-9); // Check numerical derivatives expectedH1 = numericalDerivative21(range_proxy, x2, l3); @@ -590,7 +590,7 @@ LieVector range_pose_proxy(const Pose2& pose, const Pose2& point) { } TEST( Pose2, range_pose ) { - Pose2 xl1(1, 0, M_PI_2), xl2(1, 1, M_PI), xl3(2.0, 2.0,-M_PI_2), xl4(1, 3, 0); + Pose2 xl1(1, 0, M_PI/2.0), xl2(1, 1, M_PI), xl3(2.0, 2.0,-M_PI/2.0), xl4(1, 3, 0); Matrix expectedH1, actualH1, expectedH2, actualH2; @@ -598,11 +598,11 @@ TEST( Pose2, range_pose ) EXPECT_DOUBLES_EQUAL(1,x1.range(xl1),1e-9); // establish range is indeed 45 degrees - EXPECT_DOUBLES_EQUAL(sqrt(2),x1.range(xl2),1e-9); + EXPECT_DOUBLES_EQUAL(sqrt(2.0),x1.range(xl2),1e-9); // Another pair double actual23 = x2.range(xl3, actualH1, actualH2); - EXPECT_DOUBLES_EQUAL(sqrt(2),actual23,1e-9); + EXPECT_DOUBLES_EQUAL(sqrt(2.0),actual23,1e-9); // Check numerical derivatives expectedH1 = numericalDerivative21(range_pose_proxy, x2, xl3); @@ -637,7 +637,7 @@ TEST(Pose2, align_1) { TEST(Pose2, align_2) { Point2 t(20,10); - Rot2 R = Rot2::fromAngle(M_PI_2); + Rot2 R = Rot2::fromAngle(M_PI/2.0); Pose2 expected(R, t); vector correspondences; diff --git a/gtsam/geometry/tests/testPose3.cpp b/gtsam/geometry/tests/testPose3.cpp index eb2d410f8..4ec1c6aee 100644 --- a/gtsam/geometry/tests/testPose3.cpp +++ b/gtsam/geometry/tests/testPose3.cpp @@ -535,7 +535,7 @@ TEST( Pose3, between ) /* ************************************************************************* */ // some shared test values - pulled from equivalent test in Pose2 Point3 l1(1, 0, 0), l2(1, 1, 0), l3(2, 2, 0), l4(1, 4,-4); -Pose3 x1, x2(Rot3::ypr(0.0, 0.0, 0.0), l2), x3(Rot3::ypr(M_PI_4, 0.0, 0.0), l2); +Pose3 x1, x2(Rot3::ypr(0.0, 0.0, 0.0), l2), x3(Rot3::ypr(M_PI/4.0, 0.0, 0.0), l2); Pose3 xl1(Rot3::ypr(0.0, 0.0, 0.0), Point3(1, 0, 0)), xl2(Rot3::ypr(0.0, 1.0, 0.0), Point3(1, 1, 0)), @@ -554,11 +554,11 @@ TEST( Pose3, range ) EXPECT_DOUBLES_EQUAL(1,x1.range(l1),1e-9); // establish range is indeed sqrt2 - EXPECT_DOUBLES_EQUAL(sqrt(2),x1.range(l2),1e-9); + EXPECT_DOUBLES_EQUAL(sqrt(2.0),x1.range(l2),1e-9); // Another pair double actual23 = x2.range(l3, actualH1, actualH2); - EXPECT_DOUBLES_EQUAL(sqrt(2),actual23,1e-9); + EXPECT_DOUBLES_EQUAL(sqrt(2.0),actual23,1e-9); // Check numerical derivatives expectedH1 = numericalDerivative21(range_proxy, x2, l3); @@ -589,11 +589,11 @@ TEST( Pose3, range_pose ) EXPECT_DOUBLES_EQUAL(1,x1.range(xl1),1e-9); // establish range is indeed sqrt2 - EXPECT_DOUBLES_EQUAL(sqrt(2),x1.range(xl2),1e-9); + EXPECT_DOUBLES_EQUAL(sqrt(2.0),x1.range(xl2),1e-9); // Another pair double actual23 = x2.range(xl3, actualH1, actualH2); - EXPECT_DOUBLES_EQUAL(sqrt(2),actual23,1e-9); + EXPECT_DOUBLES_EQUAL(sqrt(2.0),actual23,1e-9); // Check numerical derivatives expectedH1 = numericalDerivative21(range_pose_proxy, x2, xl3); @@ -619,7 +619,7 @@ TEST( Pose3, unicycle ) Vector x_step = delta(6,3,1.0); EXPECT(assert_equal(Pose3(Rot3::ypr(0,0,0), l1), expmap_default(x1, x_step), tol)); EXPECT(assert_equal(Pose3(Rot3::ypr(0,0,0), Point3(2,1,0)), expmap_default(x2, x_step), tol)); - EXPECT(assert_equal(Pose3(Rot3::ypr(M_PI_4,0,0), Point3(2,2,0)), expmap_default(x3, sqrt(2) * x_step), tol)); + EXPECT(assert_equal(Pose3(Rot3::ypr(M_PI/4.0,0,0), Point3(2,2,0)), expmap_default(x3, sqrt(2.0) * x_step), tol)); } /* ************************************************************************* */ diff --git a/gtsam/geometry/tests/testRot2.cpp b/gtsam/geometry/tests/testRot2.cpp index e23224898..acf385fab 100644 --- a/gtsam/geometry/tests/testRot2.cpp +++ b/gtsam/geometry/tests/testRot2.cpp @@ -43,7 +43,7 @@ TEST( Rot2, constructors_and_angle) TEST( Rot2, unit) { EXPECT(assert_equal(Point2(1.0, 0.0), Rot2::fromAngle(0).unit())); - EXPECT(assert_equal(Point2(0.0, 1.0), Rot2::fromAngle(M_PI_2).unit())); + EXPECT(assert_equal(Point2(0.0, 1.0), Rot2::fromAngle(M_PI/2.0).unit())); } /* ************************************************************************* */ @@ -94,9 +94,9 @@ TEST( Rot2, expmap) /* ************************************************************************* */ TEST(Rot2, logmap) { - Rot2 rot0(Rot2::fromAngle(M_PI_2)); + Rot2 rot0(Rot2::fromAngle(M_PI/2.0)); Rot2 rot(Rot2::fromAngle(M_PI)); - Vector expected = Vector_(1, M_PI_2); + Vector expected = Vector_(1, M_PI/2.0); Vector actual = rot0.localCoordinates(rot); CHECK(assert_equal(expected, actual)); } @@ -146,7 +146,7 @@ TEST( Rot2, relativeBearing ) // establish relativeBearing is indeed 45 degrees Rot2 actual2 = Rot2::relativeBearing(l2, actualH); - CHECK(assert_equal(Rot2::fromAngle(M_PI_4),actual2)); + CHECK(assert_equal(Rot2::fromAngle(M_PI/4.0),actual2)); // Check numerical derivative expectedH = numericalDerivative11(relativeBearing_, l2); diff --git a/gtsam/geometry/tests/testRot3M.cpp b/gtsam/geometry/tests/testRot3M.cpp index a5047f14b..7c8bd04bd 100644 --- a/gtsam/geometry/tests/testRot3M.cpp +++ b/gtsam/geometry/tests/testRot3M.cpp @@ -131,7 +131,7 @@ TEST( Rot3, rodriguez3) TEST( Rot3, rodriguez4) { Vector axis = Vector_(3,0.,0.,1.); // rotation around Z - double angle = M_PI_2; + double angle = M_PI/2.0; Rot3 actual = Rot3::rodriguez(axis, angle); double c=cos(angle),s=sin(angle); Rot3 expected(c,-s, 0, diff --git a/gtsam/geometry/tests/testSimpleCamera.cpp b/gtsam/geometry/tests/testSimpleCamera.cpp index b3df0d8f8..1990ad00a 100644 --- a/gtsam/geometry/tests/testSimpleCamera.cpp +++ b/gtsam/geometry/tests/testSimpleCamera.cpp @@ -53,7 +53,7 @@ TEST( SimpleCamera, constructor) TEST( SimpleCamera, level2) { // Create a level camera, looking in Y-direction - Pose2 pose2(0.4,0.3,M_PI_2); + Pose2 pose2(0.4,0.3,M_PI/2.0); SimpleCamera camera = SimpleCamera::level(K, pose2, 0.1); // expected diff --git a/gtsam/geometry/tests/testTensors.cpp b/gtsam/geometry/tests/testTensors.cpp index 755b274a6..85437b850 100644 --- a/gtsam/geometry/tests/testTensors.cpp +++ b/gtsam/geometry/tests/testTensors.cpp @@ -34,12 +34,12 @@ using namespace tensors; /* ************************************************************************* */ // Indices -Index<3, 'a'> a, _a; -Index<3, 'b'> b, _b; -Index<3, 'c'> c, _c; +tensors::Index<3, 'a'> a, _a; +tensors::Index<3, 'b'> b, _b; +tensors::Index<3, 'c'> c, _c; -Index<4, 'A'> A; -Index<4, 'B'> B; +tensors::Index<4, 'A'> A; +tensors::Index<4, 'B'> B; /* ************************************************************************* */ // Tensor1 @@ -58,7 +58,7 @@ TEST(Tensor1, Basics) CHECK(assert_equivalent(p(a),q(a))) // projectively equivalent // and you can take a norm, typically for normalization to the sphere - DOUBLES_EQUAL(sqrt(14),norm(p(a)),1e-9) + DOUBLES_EQUAL(sqrt(14.0),norm(p(a)),1e-9) } /* ************************************************************************* */ diff --git a/gtsam/inference/graph-inl.h b/gtsam/inference/graph-inl.h index d8395942a..f9f8aa07c 100644 --- a/gtsam/inference/graph-inl.h +++ b/gtsam/inference/graph-inl.h @@ -196,8 +196,8 @@ boost::shared_ptr composePoses(const G& graph, const PredecessorMap PoseVertex v2 = key2vertex.find(key2)->second; POSE l1Xl2 = factor->measured(); - tie(edge12, found1) = boost::edge(v1, v2, g); - tie(edge21, found2) = boost::edge(v2, v1, g); + boost::tie(edge12, found1) = boost::edge(v1, v2, g); + boost::tie(edge21, found2) = boost::edge(v2, v1, g); if (found1 && found2) throw invalid_argument ("composePoses: invalid spanning tree"); if (!found1 && !found2) continue; if (found1) diff --git a/gtsam/slam/tests/testGeneralSFMFactor.cpp b/gtsam/slam/tests/testGeneralSFMFactor.cpp index 5b8a217bc..341549309 100644 --- a/gtsam/slam/tests/testGeneralSFMFactor.cpp +++ b/gtsam/slam/tests/testGeneralSFMFactor.cpp @@ -144,8 +144,8 @@ vector genCameraVariableCalibration() { return X ; } -shared_ptr getOrdering(const vector& X, const vector& L) { - shared_ptr ordering(new Ordering); +boost::shared_ptr getOrdering(const vector& X, const vector& L) { + boost::shared_ptr ordering(new Ordering); for ( size_t i = 0 ; i < L.size() ; ++i ) ordering->push_back(Symbol('l', i)) ; for ( size_t i = 0 ; i < X.size() ; ++i ) ordering->push_back(Symbol('x', i)) ; return ordering ; diff --git a/gtsam/slam/tests/testGeneralSFMFactor_Cal3Bundler.cpp b/gtsam/slam/tests/testGeneralSFMFactor_Cal3Bundler.cpp index 76cf7d180..34391c070 100644 --- a/gtsam/slam/tests/testGeneralSFMFactor_Cal3Bundler.cpp +++ b/gtsam/slam/tests/testGeneralSFMFactor_Cal3Bundler.cpp @@ -146,8 +146,8 @@ vector genCameraVariableCalibration() { return X ; } -shared_ptr getOrdering(const vector& X, const vector& L) { - shared_ptr ordering(new Ordering); +boost::shared_ptr getOrdering(const vector& X, const vector& L) { + boost::shared_ptr ordering(new Ordering); for ( size_t i = 0 ; i < L.size() ; ++i ) ordering->push_back(Symbol('l', i)) ; for ( size_t i = 0 ; i < X.size() ; ++i ) ordering->push_back(Symbol('x', i)) ; return ordering ; diff --git a/gtsam/slam/tests/testPlanarSLAM.cpp b/gtsam/slam/tests/testPlanarSLAM.cpp index b32bf9a9c..4b69252b3 100644 --- a/gtsam/slam/tests/testPlanarSLAM.cpp +++ b/gtsam/slam/tests/testPlanarSLAM.cpp @@ -26,7 +26,7 @@ using namespace gtsam; using namespace planarSLAM; // some shared test values -static Pose2 x1, x2(1, 1, 0), x3(1, 1, M_PI_4); +static Pose2 x1, x2(1, 1, 0), x3(1, 1, M_PI/4.0); static Point2 l1(1, 0), l2(1, 1), l3(2, 2), l4(1, 3); SharedNoiseModel @@ -47,7 +47,7 @@ TEST( planarSLAM, PriorFactor_equals ) TEST( planarSLAM, BearingFactor ) { // Create factor - Rot2 z = Rot2::fromAngle(M_PI_4 + 0.1); // h(x) - z = -0.1 + Rot2 z = Rot2::fromAngle(M_PI/4.0 + 0.1); // h(x) - z = -0.1 planarSLAM::Bearing factor(PoseKey(2), PointKey(3), z, sigma); // create config @@ -75,7 +75,7 @@ TEST( planarSLAM, BearingFactor_equals ) TEST( planarSLAM, RangeFactor ) { // Create factor - double z(sqrt(2) - 0.22); // h(x) - z = 0.22 + double z(sqrt(2.0) - 0.22); // h(x) - z = 0.22 planarSLAM::Range factor(PoseKey(2), PointKey(3), z, sigma); // create config @@ -101,8 +101,8 @@ TEST( planarSLAM, RangeFactor_equals ) TEST( planarSLAM, BearingRangeFactor ) { // Create factor - Rot2 r = Rot2::fromAngle(M_PI_4 + 0.1); // h(x) - z = -0.1 - double b(sqrt(2) - 0.22); // h(x) - z = 0.22 + Rot2 r = Rot2::fromAngle(M_PI/4.0 + 0.1); // h(x) - z = -0.1 + double b(sqrt(2.0) - 0.22); // h(x) - z = 0.22 planarSLAM::BearingRange factor(PoseKey(2), PointKey(3), r, b, sigma2); // create config @@ -158,14 +158,14 @@ TEST( planarSLAM, constructor ) G.addPoseConstraint(2, x2); // make it feasible :-) // Add odometry - G.addOdometry(2, 3, Pose2(0, 0, M_PI_4), I3); + G.addOdometry(2, 3, Pose2(0, 0, M_PI/4.0), I3); // Create bearing factor - Rot2 z1 = Rot2::fromAngle(M_PI_4 + 0.1); // h(x) - z = -0.1 + Rot2 z1 = Rot2::fromAngle(M_PI/4.0 + 0.1); // h(x) - z = -0.1 G.addBearing(2, 3, z1, sigma); // Create range factor - double z2(sqrt(2) - 0.22); // h(x) - z = 0.22 + double z2(sqrt(2.0) - 0.22); // h(x) - z = 0.22 G.addRange(2, 3, z2, sigma); Vector expected0 = Vector_(3, 0.0, 0.0, 0.0); diff --git a/gtsam/slam/tests/testPose2SLAM.cpp b/gtsam/slam/tests/testPose2SLAM.cpp index 5aa633bbf..d97f99c72 100644 --- a/gtsam/slam/tests/testPose2SLAM.cpp +++ b/gtsam/slam/tests/testPose2SLAM.cpp @@ -72,7 +72,7 @@ TEST( Pose2SLAM, constraint1 ) /* ************************************************************************* */ // Test constraint, large displacement Vector f2(const Pose2& pose1, const Pose2& pose2) { - Pose2 z(2,2,M_PI_2); + Pose2 z(2,2,M_PI/2.0); Pose2Factor constraint(PoseKey(1), PoseKey(2), z, covariance); return constraint.evaluateError(pose1, pose2); } @@ -80,7 +80,7 @@ Vector f2(const Pose2& pose1, const Pose2& pose2) { TEST( Pose2SLAM, constraint2 ) { // create a factor between unknown poses p1 and p2 - Pose2 pose1, pose2(2,2,M_PI_2); + Pose2 pose1, pose2(2,2,M_PI/2.0); Pose2Factor constraint(PoseKey(1), PoseKey(2), pose2, covariance); Matrix H1, H2; Vector actual = constraint.evaluateError(pose1, pose2, H1, H2); @@ -96,7 +96,7 @@ TEST( Pose2SLAM, constraint2 ) TEST( Pose2SLAM, constructor ) { // create a factor between unknown poses p1 and p2 - Pose2 measured(2,2,M_PI_2); + Pose2 measured(2,2,M_PI/2.0); pose2SLAM::Graph graph; graph.addOdometry(1,2,measured, covariance); // get the size of the graph @@ -110,13 +110,13 @@ TEST( Pose2SLAM, constructor ) TEST( Pose2SLAM, linearization ) { // create a factor between unknown poses p1 and p2 - Pose2 measured(2,2,M_PI_2); + Pose2 measured(2,2,M_PI/2.0); Pose2Factor constraint(PoseKey(1), PoseKey(2), measured, covariance); pose2SLAM::Graph graph; graph.addOdometry(1,2,measured, covariance); // Choose a linearization point - Pose2 p1(1.1,2,M_PI_2); // robot at (1.1,2) looking towards y (ground truth is at 1,2, see testPose2) + Pose2 p1(1.1,2,M_PI/2.0); // robot at (1.1,2) looking towards y (ground truth is at 1,2, see testPose2) Pose2 p2(-1,4.1,M_PI); // robot at (-1,4) looking at negative (ground truth is at 4.1,2) pose2SLAM::Values config; config.insert(pose2SLAM::PoseKey(1),p1); @@ -151,7 +151,7 @@ TEST(Pose2SLAM, optimize) { // create a Pose graph with one equality constraint and one measurement pose2SLAM::Graph fg; fg.addPoseConstraint(0, Pose2(0,0,0)); - fg.addOdometry(0, 1, Pose2(1,2,M_PI_2), covariance); + fg.addOdometry(0, 1, Pose2(1,2,M_PI/2.0), covariance); // Create initial config Values initial; @@ -170,7 +170,7 @@ TEST(Pose2SLAM, optimize) { // Check with expected config Values expected; expected.insert(pose2SLAM::PoseKey(0), Pose2(0,0,0)); - expected.insert(pose2SLAM::PoseKey(1), Pose2(1,2,M_PI_2)); + expected.insert(pose2SLAM::PoseKey(1), Pose2(1,2,M_PI/2.0)); CHECK(assert_equal(expected, actual)); // Check marginals @@ -348,9 +348,9 @@ TEST(Pose2Values, pose2Circle ) { // expected is 4 poses tangent to circle with radius 1m pose2SLAM::Values expected; - expected.insert(pose2SLAM::PoseKey(0), Pose2( 1, 0, M_PI_2)); + expected.insert(pose2SLAM::PoseKey(0), Pose2( 1, 0, M_PI/2.0)); expected.insert(pose2SLAM::PoseKey(1), Pose2( 0, 1, - M_PI )); - expected.insert(pose2SLAM::PoseKey(2), Pose2(-1, 0, - M_PI_2)); + expected.insert(pose2SLAM::PoseKey(2), Pose2(-1, 0, - M_PI/2.0)); expected.insert(pose2SLAM::PoseKey(3), Pose2( 0, -1, 0 )); pose2SLAM::Values actual = pose2SLAM::circle(4,1.0); @@ -362,9 +362,9 @@ TEST(Pose2SLAM, expmap ) { // expected is circle shifted to right pose2SLAM::Values expected; - expected.insert(pose2SLAM::PoseKey(0), Pose2( 1.1, 0, M_PI_2)); + expected.insert(pose2SLAM::PoseKey(0), Pose2( 1.1, 0, M_PI/2.0)); expected.insert(pose2SLAM::PoseKey(1), Pose2( 0.1, 1, - M_PI )); - expected.insert(pose2SLAM::PoseKey(2), Pose2(-0.9, 0, - M_PI_2)); + expected.insert(pose2SLAM::PoseKey(2), Pose2(-0.9, 0, - M_PI/2.0)); expected.insert(pose2SLAM::PoseKey(3), Pose2( 0.1, -1, 0 )); // Note expmap coordinates are in local coordinates, so shifting to right requires thought !!! @@ -418,7 +418,7 @@ TEST( Pose2Prior, error ) /* ************************************************************************* */ // common Pose2Prior for tests below -static gtsam::Pose2 priorVal(2,2,M_PI_2); +static gtsam::Pose2 priorVal(2,2,M_PI/2.0); static pose2SLAM::Prior priorFactor(PoseKey(1), priorVal, sigmas); /* ************************************************************************* */ @@ -484,14 +484,14 @@ TEST( Pose2Factor, error ) /* ************************************************************************* */ // common Pose2Factor for tests below -static Pose2 measured(2,2,M_PI_2); +static Pose2 measured(2,2,M_PI/2.0); static Pose2Factor factor(PoseKey(1),PoseKey(2),measured, covariance); /* ************************************************************************* */ TEST( Pose2Factor, rhs ) { // Choose a linearization point - Pose2 p1(1.1,2,M_PI_2); // robot at (1.1,2) looking towards y (ground truth is at 1,2, see testPose2) + Pose2 p1(1.1,2,M_PI/2.0); // robot at (1.1,2) looking towards y (ground truth is at 1,2, see testPose2) Pose2 p2(-1,4.1,M_PI); // robot at (-1,4.1) looking at negative (ground truth is at -1,4) pose2SLAM::Values x0; x0.insert(pose2SLAM::PoseKey(1),p1); @@ -504,7 +504,7 @@ TEST( Pose2Factor, rhs ) // Check RHS Pose2 hx0 = p1.between(p2); - CHECK(assert_equal(Pose2(2.1, 2.1, M_PI_2),hx0)); + CHECK(assert_equal(Pose2(2.1, 2.1, M_PI/2.0),hx0)); Vector expected_b = Vector_(3, -0.1/sx, 0.1/sy, 0.0); CHECK(assert_equal(expected_b,-factor.whitenedError(x0))); CHECK(assert_equal(expected_b,linear->getb())); @@ -521,7 +521,7 @@ LieVector h(const Pose2& p1,const Pose2& p2) { TEST( Pose2Factor, linearize ) { // Choose a linearization point at ground truth - Pose2 p1(1,2,M_PI_2); + Pose2 p1(1,2,M_PI/2.0); Pose2 p2(-1,4,M_PI); pose2SLAM::Values x0; x0.insert(pose2SLAM::PoseKey(1),p1); diff --git a/tests/testDoglegOptimizer.cpp b/tests/testDoglegOptimizer.cpp index b16ac0cdc..c6241124a 100644 --- a/tests/testDoglegOptimizer.cpp +++ b/tests/testDoglegOptimizer.cpp @@ -31,7 +31,6 @@ using namespace std; using namespace gtsam; -using boost::shared_ptr; /* ************************************************************************* */ double computeError(const GaussianBayesNet& gbn, const LieVector& values) { @@ -381,7 +380,7 @@ TEST(DoglegOptimizer, ComputeDoglegPoint) { /* ************************************************************************* */ TEST(DoglegOptimizer, Iterate) { // really non-linear factor graph - shared_ptr fg(new example::Graph( + boost::shared_ptr fg(new example::Graph( example::createReallyNonlinearFactorGraph())); // config far from minimum @@ -390,7 +389,7 @@ TEST(DoglegOptimizer, Iterate) { config->insert(simulated2D::PoseKey(1), x0); // ordering - shared_ptr ord(new Ordering()); + boost::shared_ptr ord(new Ordering()); ord->push_back(simulated2D::PoseKey(1)); double Delta = 1.0; diff --git a/tests/testGaussianFactor.cpp b/tests/testGaussianFactor.cpp index 2cfb7a076..cb3ea18e7 100644 --- a/tests/testGaussianFactor.cpp +++ b/tests/testGaussianFactor.cpp @@ -263,7 +263,7 @@ TEST( GaussianFactor, matrix ) EQUALITY(b_act2,b2); // Ensure that whitening is consistent - shared_ptr model = lf->get_model(); + boost::shared_ptr model = lf->get_model(); model->WhitenSystem(A_act2, b_act2); EQUALITY(A_act1, A_act2); EQUALITY(b_act1, b_act2); @@ -307,7 +307,7 @@ TEST( GaussianFactor, matrix_aug ) EQUALITY(Ab_act2,Ab2); // Ensure that whitening is consistent - shared_ptr model = lf->get_model(); + boost::shared_ptr model = lf->get_model(); model->WhitenInPlace(Ab_act1); EQUALITY(Ab_act1, Ab_act2); } diff --git a/tests/testGaussianFactorGraphB.cpp b/tests/testGaussianFactorGraphB.cpp index 2e68200f5..82e8401d6 100644 --- a/tests/testGaussianFactorGraphB.cpp +++ b/tests/testGaussianFactorGraphB.cpp @@ -232,7 +232,7 @@ TEST( GaussianFactorGraph, eliminateOne_l1 ) GaussianConditional::shared_ptr actual = inference::eliminateOne(fg, 0, EliminateQR).first; // create expected Conditional Gaussian - double sig = sqrt(2)/10.; + double sig = sqrt(2.0)/10.; Matrix I = eye(2)/sig, R11 = I, S12 = -0.5*I, S13 = -0.5*I; Vector d = Vector_(2, -0.1, 0.25)/sig, sigma = ones(2); GaussianConditional expected(ordering[kl(1)],d,R11,ordering[kx(1)],S12,ordering[kx(2)],S13,sigma); @@ -295,7 +295,7 @@ TEST( GaussianFactorGraph, eliminateOne_l1_fast ) GaussianConditional::shared_ptr actual = inference::eliminateOne(fg, ordering[kl(1)], EliminateQR).first; // create expected Conditional Gaussian - double sig = sqrt(2)/10.; + double sig = sqrt(2.0)/10.; Matrix I = eye(2)/sig, R11 = I, S12 = -0.5*I, S13 = -0.5*I; Vector d = Vector_(2, -0.1, 0.25)/sig, sigma = ones(2); GaussianConditional expected(ordering[kl(1)],d,R11,ordering[kx(1)],S12,ordering[kx(2)],S13,sigma); diff --git a/tests/testGraph.cpp b/tests/testGraph.cpp index f56efae82..6ab543d1e 100644 --- a/tests/testGraph.cpp +++ b/tests/testGraph.cpp @@ -70,7 +70,7 @@ TEST( Graph, predecessorMap2Graph ) p_map.insert(kx(1), kx(2)); p_map.insert(kx(2), kx(2)); p_map.insert(kx(3), kx(2)); - tie(graph, root, key2vertex) = predecessorMap2Graph, SVertex, Key>(p_map); + boost::tie(graph, root, key2vertex) = predecessorMap2Graph, SVertex, Key>(p_map); LONGS_EQUAL(3, boost::num_vertices(graph)); CHECK(root == key2vertex[kx(2)]); diff --git a/tests/testInferenceB.cpp b/tests/testInferenceB.cpp index 6ad070698..d399f6eac 100644 --- a/tests/testInferenceB.cpp +++ b/tests/testInferenceB.cpp @@ -41,7 +41,7 @@ TEST( inference, marginals ) *GaussianSequentialSolver(GaussianFactorGraph(cbn)).jointFactorGraph(xvar)).eliminate(); // expected is just scalar Gaussian on x - GaussianBayesNet expected = scalarGaussian(0, 4, sqrt(2)); + GaussianBayesNet expected = scalarGaussian(0, 4, sqrt(2.0)); CHECK(assert_equal(expected,actual)); } diff --git a/tests/testMarginals.cpp b/tests/testMarginals.cpp index a91e6b576..1563e395e 100644 --- a/tests/testMarginals.cpp +++ b/tests/testMarginals.cpp @@ -71,7 +71,7 @@ TEST(Marginals, planarSLAMmarginals) { Rot2 bearing11 = Rot2::fromDegrees(45), bearing21 = Rot2::fromDegrees(90), bearing32 = Rot2::fromDegrees(90); - double range11 = sqrt(4+4), + double range11 = sqrt(4.0+4.0), range21 = 2.0, range32 = 2.0;