From 3c33e44c4614a61608cbed28438cebbc7e5f85f4 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 29 Oct 2013 04:24:14 +0000 Subject: [PATCH] Fixed compile errors on windows --- gtsam/base/LieMatrix.h | 2 +- gtsam/discrete/DiscreteFactorGraph.h | 12 ++++++------ gtsam/linear/tests/testGaussianBayesNetUnordered.cpp | 10 +++++----- .../linear/tests/testGaussianBayesTreeUnordered.cpp | 4 ++-- .../tests/testGaussianConditionalUnordered.cpp | 8 ++++---- gtsam/linear/tests/testHessianFactorUnordered.cpp | 7 +++---- gtsam/nonlinear/tests/testValues.cpp | 8 ++++---- gtsam_unstable/geometry/triangulation.h | 2 +- tests/smallExample.h | 6 +++--- 9 files changed, 29 insertions(+), 30 deletions(-) diff --git a/gtsam/base/LieMatrix.h b/gtsam/base/LieMatrix.h index 67cdfe815..0a27eff69 100644 --- a/gtsam/base/LieMatrix.h +++ b/gtsam/base/LieMatrix.h @@ -56,7 +56,7 @@ struct LieMatrix : public Matrix, public DerivedValue { /// @{ /** print @param s optional string naming the object */ - void print(const std::string& name="") const; + GTSAM_EXPORT void print(const std::string& name="") const; /** equality up to tolerance */ inline bool equals(const LieMatrix& expected, double tol=1e-5) const { diff --git a/gtsam/discrete/DiscreteFactorGraph.h b/gtsam/discrete/DiscreteFactorGraph.h index c5346cc54..2230eb33b 100644 --- a/gtsam/discrete/DiscreteFactorGraph.h +++ b/gtsam/discrete/DiscreteFactorGraph.h @@ -38,7 +38,7 @@ class DiscreteBayesTree; class DiscreteJunctionTree; /** Main elimination function for DiscreteFactorGraph */ -std::pair, DecisionTreeFactor::shared_ptr> +GTSAM_EXPORT std::pair, DecisionTreeFactor::shared_ptr> EliminateDiscrete(const DiscreteFactorGraph& factors, const Ordering& keys); /* ************************************************************************* */ @@ -62,7 +62,7 @@ template<> struct EliminationTraits * A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e. * Factor == DiscreteFactor */ -class DiscreteFactorGraph: public FactorGraph, +class GTSAM_EXPORT DiscreteFactorGraph: public FactorGraph, public EliminateableFactorGraph { public: @@ -120,16 +120,16 @@ public: } /** Return the set of variables involved in the factors (set union) */ - GTSAM_EXPORT FastSet keys() const; + FastSet keys() const; /** return product of all factors as a single factor */ - GTSAM_EXPORT DecisionTreeFactor product() const; + DecisionTreeFactor product() const; /** Evaluates the factor graph given values, returns the joint probability of the factor graph given specific instantiation of values*/ - GTSAM_EXPORT double operator()(const DiscreteFactor::Values & values) const; + double operator()(const DiscreteFactor::Values & values) const; /// print - GTSAM_EXPORT void print(const std::string& s = "DiscreteFactorGraph", + void print(const std::string& s = "DiscreteFactorGraph", const IndexFormatter& formatter =DefaultIndexFormatter) const; /** Solve the factor graph by performing variable elimination in COLAMD order using diff --git a/gtsam/linear/tests/testGaussianBayesNetUnordered.cpp b/gtsam/linear/tests/testGaussianBayesNetUnordered.cpp index 8125fcfbf..ce891c49b 100644 --- a/gtsam/linear/tests/testGaussianBayesNetUnordered.cpp +++ b/gtsam/linear/tests/testGaussianBayesNetUnordered.cpp @@ -62,7 +62,7 @@ TEST( GaussianBayesNet, optimize ) { VectorValues actual = smallBayesNet.optimize(); - VectorValues expected = map_list_of + VectorValues expected = map_list_of (_x_, (Vec(1) << 4.0)) (_y_, (Vec(1) << 5.0)); @@ -77,12 +77,12 @@ TEST( GaussianBayesNet, optimize3 ) // 5 1 5 // NOTE: we are supplying a new RHS here - VectorValues expected = map_list_of + VectorValues expected = map_list_of (_x_, (Vec(1) << -1.0)) (_y_, (Vec(1) << 5.0)); // Test different RHS version - VectorValues gx = map_list_of + VectorValues gx = map_list_of (_x_, (Vec(1) << 4.0)) (_y_, (Vec(1) << 5.0)); VectorValues actual = smallBayesNet.backSubstitute(gx); @@ -96,10 +96,10 @@ TEST( GaussianBayesNet, backSubstituteTranspose ) // 2 = 1 2 // 5 1 1 3 VectorValues - x = map_list_of + x = map_list_of (_x_, (Vec(1) << 2.0)) (_y_, (Vec(1) << 5.0)), - expected = map_list_of + expected = map_list_of (_x_, (Vec(1) << 2.0)) (_y_, (Vec(1) << 3.0)); diff --git a/gtsam/linear/tests/testGaussianBayesTreeUnordered.cpp b/gtsam/linear/tests/testGaussianBayesTreeUnordered.cpp index 1a0762d5d..c8f98d52c 100644 --- a/gtsam/linear/tests/testGaussianBayesTreeUnordered.cpp +++ b/gtsam/linear/tests/testGaussianBayesTreeUnordered.cpp @@ -98,7 +98,7 @@ TEST( GaussianBayesTree, eliminate ) /* ************************************************************************* */ TEST( GaussianBayesTree, optimizeMultiFrontal ) { - VectorValues expected = pair_list_of + VectorValues expected = pair_list_of (x1, (Vec(1) << 0.)) (x2, (Vec(1) << 1.)) (x3, (Vec(1) << 0.)) @@ -263,7 +263,7 @@ TEST(GaussianBayesTree, ComputeSteepestDescentPointBT) { Vector expected = gradient * step; // Known steepest descent point from Bayes' net version - VectorValues expectedFromBN = pair_list_of + VectorValues expectedFromBN = pair_list_of (0, (Vec(2) << 0.000129034, 0.000688183)) (1, (Vec(2) << 0.0109679, 0.0253767)) (2, (Vec(2) << 0.0680441, 0.114496)) diff --git a/gtsam/linear/tests/testGaussianConditionalUnordered.cpp b/gtsam/linear/tests/testGaussianConditionalUnordered.cpp index 5fb5631aa..d11b0b107 100644 --- a/gtsam/linear/tests/testGaussianConditionalUnordered.cpp +++ b/gtsam/linear/tests/testGaussianConditionalUnordered.cpp @@ -183,7 +183,7 @@ TEST( GaussianConditional, solve_simple ) VectorValues actual = map_list_of (2, sx1); // parent - VectorValues expected = map_list_of + VectorValues expected = map_list_of (2, sx1) (1, (Vec(4) << -3.1,-3.4,-11.9,-13.2)); @@ -219,7 +219,7 @@ TEST( GaussianConditional, solve_multifrontal ) VectorValues actual = map_list_of (10, sl1); // parent - VectorValues expected = map_list_of + VectorValues expected = map_list_of (1, (Vector)(Vec(2) << -3.1,-3.4)) (2, (Vector)(Vec(2) << -11.9,-13.2)) (10, sl1); @@ -257,10 +257,10 @@ TEST( GaussianConditional, solveTranspose ) { // 5 1 1 3 VectorValues - x = map_list_of + x = map_list_of (1, (Vec(1) << 2.)) (2, (Vec(1) << 5.)), - y = map_list_of + y = map_list_of (1, (Vec(1) << 2.)) (2, (Vec(1) << 3.)); diff --git a/gtsam/linear/tests/testHessianFactorUnordered.cpp b/gtsam/linear/tests/testHessianFactorUnordered.cpp index 94f4efb36..f2793afbe 100644 --- a/gtsam/linear/tests/testHessianFactorUnordered.cpp +++ b/gtsam/linear/tests/testHessianFactorUnordered.cpp @@ -74,7 +74,7 @@ TEST(HessianFactor, ConversionConstructor) HessianFactor actual(jacobian); - VectorValues values = pair_list_of + VectorValues values = pair_list_of (0, (Vec(2) << 1.0, 2.0)) (1, (Vec(4) << 3.0, 4.0, 5.0, 6.0)); @@ -89,7 +89,6 @@ TEST(HessianFactor, Constructor1) Matrix G = Matrix_(2,2, 3.0, 5.0, 0.0, 6.0); Vector g = (Vec(2) << -8.0, -9.0); double f = 10.0; - HessianFactor factor(0, G, g, f); // extract underlying parts @@ -98,7 +97,7 @@ TEST(HessianFactor, Constructor1) EXPECT(assert_equal(g, Vector(factor.linearTerm()))); EXPECT_LONGS_EQUAL(1, (long)factor.size()); - VectorValues dx = pair_list_of(0, (Vec(2) << 1.5, 2.5)); + VectorValues dx = pair_list_of(0, (Vec(2) << 1.5, 2.5)); // error 0.5*(f - 2*x'*g + x'*G*x) double expected = 80.375; @@ -162,7 +161,7 @@ TEST(HessianFactor, Constructor2) EXPECT(assert_equal(G22, factor.info(factor.begin()+1, factor.begin()+1))); // Check case when vector values is larger than factor - VectorValues dxLarge = pair_list_of + VectorValues dxLarge = pair_list_of (0, dx0) (1, dx1) (2, (Vec(2) << 0.1, 0.2)); diff --git a/gtsam/nonlinear/tests/testValues.cpp b/gtsam/nonlinear/tests/testValues.cpp index 3093c5376..374cd045e 100644 --- a/gtsam/nonlinear/tests/testValues.cpp +++ b/gtsam/nonlinear/tests/testValues.cpp @@ -170,7 +170,7 @@ TEST(Values, expmap_a) config0.insert(key1, LieVector(3, 1.0, 2.0, 3.0)); config0.insert(key2, LieVector(3, 5.0, 6.0, 7.0)); - VectorValues increment = pair_list_of + VectorValues increment = pair_list_of (key1, (Vec(3) << 1.0, 1.1, 1.2)) (key2, (Vec(3) << 1.3, 1.4, 1.5)); @@ -188,8 +188,8 @@ TEST(Values, expmap_b) config0.insert(key1, LieVector(3, 1.0, 2.0, 3.0)); config0.insert(key2, LieVector(3, 5.0, 6.0, 7.0)); - VectorValues increment = pair_list_of - (key2, LieVector(3, 1.3, 1.4, 1.5)); + VectorValues increment = pair_list_of + (key2, (Vec(3) << 1.3, 1.4, 1.5)); Values expected; expected.insert(key1, LieVector(3, 1.0, 2.0, 3.0)); @@ -241,7 +241,7 @@ TEST(Values, localCoordinates) valuesA.insert(key1, LieVector(3, 1.0, 2.0, 3.0)); valuesA.insert(key2, LieVector(3, 5.0, 6.0, 7.0)); - VectorValues expDelta = pair_list_of + VectorValues expDelta = pair_list_of (key1, (Vec(3) << 0.1, 0.2, 0.3)) (key2, (Vec(3) << 0.4, 0.5, 0.6)); diff --git a/gtsam_unstable/geometry/triangulation.h b/gtsam_unstable/geometry/triangulation.h index b662b2bee..2145a37fd 100644 --- a/gtsam_unstable/geometry/triangulation.h +++ b/gtsam_unstable/geometry/triangulation.h @@ -157,7 +157,7 @@ Point3 triangulateDLT(const std::vector& poses, * @return Returns a Point3 on success, boost::none otherwise. */ template -GTSAM_UNSTABLE_EXPORT Point3 triangulatePoint3(const std::vector& poses, +Point3 triangulatePoint3(const std::vector& poses, const std::vector& measurements, const CALIBRATION& K, double rank_tol = 1e-9, bool optimize = false) { diff --git a/tests/smallExample.h b/tests/smallExample.h index 40611c087..ca06a96df 100644 --- a/tests/smallExample.h +++ b/tests/smallExample.h @@ -222,7 +222,7 @@ Values createValues() { /* ************************************************************************* */ VectorValues createVectorValues() { using namespace impl; - VectorValues c = boost::assign::pair_list_of + VectorValues c = boost::assign::pair_list_of (_l1_, (Vec(2) << 0.0, -1.0)) (_x1_, (Vec(2) << 0.0, 0.0)) (_x2_, (Vec(2) << 1.5, 0.0)); @@ -483,7 +483,7 @@ GaussianFactorGraph createSingleConstraintGraph() { /* ************************************************************************* */ VectorValues createSingleConstraintValues() { using namespace impl; - VectorValues config = boost::assign::pair_list_of + VectorValues config = boost::assign::pair_list_of (_x_, (Vec(2) << 1.0, -1.0)) (_y_, (Vec(2) << 0.2, 0.1)); return config; @@ -547,7 +547,7 @@ GaussianFactorGraph createMultiConstraintGraph() { /* ************************************************************************* */ VectorValues createMultiConstraintValues() { using namespace impl; - VectorValues config = boost::assign::pair_list_of + VectorValues config = boost::assign::pair_list_of (_x_, (Vec(2) << -2.0, 2.0)) (_y_, (Vec(2) << -0.1, 0.4)) (_z_, (Vec(2) <<-4.0, 5.0));