From 8e754895f15aa7de08b6a43c004835b7fc810ec6 Mon Sep 17 00:00:00 2001 From: Chris Beall Date: Thu, 28 Oct 2010 19:53:29 +0000 Subject: [PATCH] fixed linking issue on Mac w/ gcc 4.2 --- gtsam/inference/EliminationTree-inl.h | 2 +- gtsam/inference/JunctionTree-inl.h | 2 +- gtsam/inference/Makefile.am | 2 +- gtsam/inference/VariableSlots-inl.h | 66 --------------------- gtsam/inference/VariableSlots.h | 39 ++++++++++++ gtsam/inference/tests/testVariableSlots.cpp | 2 +- 6 files changed, 43 insertions(+), 70 deletions(-) delete mode 100644 gtsam/inference/VariableSlots-inl.h diff --git a/gtsam/inference/EliminationTree-inl.h b/gtsam/inference/EliminationTree-inl.h index 19b32c4c7..9b9d5d2f0 100644 --- a/gtsam/inference/EliminationTree-inl.h +++ b/gtsam/inference/EliminationTree-inl.h @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include diff --git a/gtsam/inference/JunctionTree-inl.h b/gtsam/inference/JunctionTree-inl.h index 76f760509..c9938f330 100644 --- a/gtsam/inference/JunctionTree-inl.h +++ b/gtsam/inference/JunctionTree-inl.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/gtsam/inference/Makefile.am b/gtsam/inference/Makefile.am index 6e4f0abf9..6bc2db28e 100644 --- a/gtsam/inference/Makefile.am +++ b/gtsam/inference/Makefile.am @@ -24,7 +24,7 @@ check_PROGRAMS += tests/testSymbolicBayesNet tests/testVariableIndex tests/testV # Inference headers += GenericMultifrontalSolver.h GenericMultifrontalSolver-inl.h GenericSequentialSolver.h GenericSequentialSolver-inl.h -headers += inference-inl.h VariableSlots-inl.h +headers += inference-inl.h sources += inference.cpp VariableSlots.cpp Permutation.cpp VariableIndex.cpp sources += IndexFactor.cpp IndexConditional.cpp headers += graph.h graph-inl.h diff --git a/gtsam/inference/VariableSlots-inl.h b/gtsam/inference/VariableSlots-inl.h deleted file mode 100644 index aa762f3db..000000000 --- a/gtsam/inference/VariableSlots-inl.h +++ /dev/null @@ -1,66 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - -/** - * @file VariableSlots-inl.h - * @brief - * @author Richard Roberts - * @created Oct 5, 2010 - */ - -#pragma once - -#include - -#include - -#include -#include - -namespace gtsam { - -using namespace std; - -/* ************************************************************************* */ -template -VariableSlots::VariableSlots(const FG& factorGraph) { - static const bool debug = false; - - // Compute a mapping (called variableSlots) *from* each involved - // variable that will be in the new joint factor *to* the slot in each - // removed factor in which that variable appears. For each variable, - // this is stored as a vector of slot numbers, stored in order of the - // removed factors. The slot number is the max integer value if the - // factor does not involve that variable. - size_t jointFactorPos = 0; - BOOST_FOREACH(const typename FG::sharedFactor& factor, factorGraph) { - assert(factor); - Index factorVarSlot = 0; - BOOST_FOREACH(const Index involvedVariable, *factor) { - // Set the slot in this factor for this variable. If the - // variable was not already discovered, create an array for it - // that we'll fill with the slot indices for each factor that - // we're combining. Initially we put the max integer value in - // the array entry for each factor that will indicate the factor - // does not involve the variable. - iterator thisVarSlots; bool inserted; - boost::tie(thisVarSlots, inserted) = this->insert(make_pair(involvedVariable, vector())); - if(inserted) - thisVarSlots->second.resize(factorGraph.size(), numeric_limits::max()); - thisVarSlots->second[jointFactorPos] = factorVarSlot; - if(debug) cout << " var " << involvedVariable << " rowblock " << jointFactorPos << " comes from factor's slot " << factorVarSlot << endl; - ++ factorVarSlot; - } - ++ jointFactorPos; - } -} - -} diff --git a/gtsam/inference/VariableSlots.h b/gtsam/inference/VariableSlots.h index 0dc2ae7fe..bddbff61b 100644 --- a/gtsam/inference/VariableSlots.h +++ b/gtsam/inference/VariableSlots.h @@ -22,6 +22,11 @@ #include #include +#include + +#include +#include + #include #include #include @@ -72,4 +77,38 @@ public: bool equals(const VariableSlots& rhs, double tol = 0.0) const; }; +/* ************************************************************************* */ +template +VariableSlots::VariableSlots(const FG& factorGraph) { + static const bool debug = false; + + // Compute a mapping (called variableSlots) *from* each involved + // variable that will be in the new joint factor *to* the slot in each + // removed factor in which that variable appears. For each variable, + // this is stored as a vector of slot numbers, stored in order of the + // removed factors. The slot number is the max integer value if the + // factor does not involve that variable. + size_t jointFactorPos = 0; + BOOST_FOREACH(const typename FG::sharedFactor& factor, factorGraph) { + assert(factor); + Index factorVarSlot = 0; + BOOST_FOREACH(const Index involvedVariable, *factor) { + // Set the slot in this factor for this variable. If the + // variable was not already discovered, create an array for it + // that we'll fill with the slot indices for each factor that + // we're combining. Initially we put the max integer value in + // the array entry for each factor that will indicate the factor + // does not involve the variable. + iterator thisVarSlots; bool inserted; + boost::tie(thisVarSlots, inserted) = this->insert(make_pair(involvedVariable, std::vector())); + if(inserted) + thisVarSlots->second.resize(factorGraph.size(), std::numeric_limits::max()); + thisVarSlots->second[jointFactorPos] = factorVarSlot; + if(debug) std::cout << " var " << involvedVariable << " rowblock " << jointFactorPos << " comes from factor's slot " << factorVarSlot << std::endl; + ++ factorVarSlot; + } + ++ jointFactorPos; + } +} + } diff --git a/gtsam/inference/tests/testVariableSlots.cpp b/gtsam/inference/tests/testVariableSlots.cpp index 4d27587a5..5dc8e1f57 100644 --- a/gtsam/inference/tests/testVariableSlots.cpp +++ b/gtsam/inference/tests/testVariableSlots.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include