From 29085b94a2a3630a7e2e587239f0612165a1fb4f Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Thu, 2 Jan 2014 18:38:47 -0500 Subject: [PATCH] Check invsigmas and precisions indeed infinity in case of constrained models --- gtsam/linear/tests/testNoiseModel.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/gtsam/linear/tests/testNoiseModel.cpp b/gtsam/linear/tests/testNoiseModel.cpp index 7a0e02722..2165038bf 100644 --- a/gtsam/linear/tests/testNoiseModel.cpp +++ b/gtsam/linear/tests/testNoiseModel.cpp @@ -17,18 +17,21 @@ */ -#include -#include -#include -using namespace boost::assign; +#include +#include #include -#include -#include + +#include +#include + +#include +#include using namespace std; using namespace gtsam; using namespace noiseModel; +using namespace boost::assign; static double sigma = 2, s_1=1.0/sigma, var = sigma*sigma, prc = 1.0/var; static Matrix R = Matrix_(3, 3, @@ -40,7 +43,7 @@ static Matrix Sigma = Matrix_(3, 3, 0.0, var, 0.0, 0.0, 0.0, var); -//static double inf = std::numeric_limits::infinity(); +//static double inf = numeric_limits::infinity(); /* ************************************************************************* */ TEST(NoiseModel, constructors) @@ -155,7 +158,12 @@ TEST(NoiseModel, ConstrainedConstructors ) Vector sigmas = Vector_(3, sigma, 0.0, 0.0); Vector mu = Vector_(3, 200.0, 300.0, 400.0); actual = Constrained::All(d); + // TODO: why should this be a thousand ??? Dummy variable? EXPECT(assert_equal(gtsam::repeat(d, 1000.0), actual->mu())); + EXPECT(assert_equal(gtsam::repeat(d, 0), actual->sigmas())); + double Inf = numeric_limits::infinity(); + EXPECT(assert_equal(gtsam::repeat(d, Inf), actual->invsigmas())); + EXPECT(assert_equal(gtsam::repeat(d, Inf), actual->precisions())); actual = Constrained::All(d, m); EXPECT(assert_equal(gtsam::repeat(d, m), actual->mu()));