fixed linking issue on Mac w/ gcc 4.2
parent
b53bcc7d66
commit
8e754895f1
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtsam/inference/EliminationTree.h>
|
#include <gtsam/inference/EliminationTree.h>
|
||||||
#include <gtsam/inference/VariableSlots-inl.h>
|
#include <gtsam/inference/VariableSlots.h>
|
||||||
#include <gtsam/inference/FactorGraph-inl.h>
|
#include <gtsam/inference/FactorGraph-inl.h>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <gtsam/inference/BayesTree-inl.h>
|
#include <gtsam/inference/BayesTree-inl.h>
|
||||||
#include <gtsam/inference/JunctionTree.h>
|
#include <gtsam/inference/JunctionTree.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
#include <gtsam/inference/inference-inl.h>
|
||||||
#include <gtsam/inference/VariableSlots-inl.h>
|
#include <gtsam/inference/VariableSlots.h>
|
||||||
#include <gtsam/inference/SymbolicSequentialSolver.h>
|
#include <gtsam/inference/SymbolicSequentialSolver.h>
|
||||||
#include <gtsam/inference/ClusterTree-inl.h>
|
#include <gtsam/inference/ClusterTree-inl.h>
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ check_PROGRAMS += tests/testSymbolicBayesNet tests/testVariableIndex tests/testV
|
||||||
|
|
||||||
# Inference
|
# Inference
|
||||||
headers += GenericMultifrontalSolver.h GenericMultifrontalSolver-inl.h GenericSequentialSolver.h GenericSequentialSolver-inl.h
|
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 += inference.cpp VariableSlots.cpp Permutation.cpp VariableIndex.cpp
|
||||||
sources += IndexFactor.cpp IndexConditional.cpp
|
sources += IndexFactor.cpp IndexConditional.cpp
|
||||||
headers += graph.h graph-inl.h
|
headers += graph.h graph-inl.h
|
||||||
|
|
|
@ -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 <gtsam/inference/VariableSlots.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
|
||||||
|
|
||||||
namespace gtsam {
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
template<class FG>
|
|
||||||
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<Index>()));
|
|
||||||
if(inserted)
|
|
||||||
thisVarSlots->second.resize(factorGraph.size(), numeric_limits<Index>::max());
|
|
||||||
thisVarSlots->second[jointFactorPos] = factorVarSlot;
|
|
||||||
if(debug) cout << " var " << involvedVariable << " rowblock " << jointFactorPos << " comes from factor's slot " << factorVarSlot << endl;
|
|
||||||
++ factorVarSlot;
|
|
||||||
}
|
|
||||||
++ jointFactorPos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -22,6 +22,11 @@
|
||||||
#include <gtsam/base/Testable.h>
|
#include <gtsam/base/Testable.h>
|
||||||
#include <gtsam/base/FastMap.h>
|
#include <gtsam/base/FastMap.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -72,4 +77,38 @@ public:
|
||||||
bool equals(const VariableSlots& rhs, double tol = 0.0) const;
|
bool equals(const VariableSlots& rhs, double tol = 0.0) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
template<class FG>
|
||||||
|
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<Index>()));
|
||||||
|
if(inserted)
|
||||||
|
thisVarSlots->second.resize(factorGraph.size(), std::numeric_limits<Index>::max());
|
||||||
|
thisVarSlots->second[jointFactorPos] = factorVarSlot;
|
||||||
|
if(debug) std::cout << " var " << involvedVariable << " rowblock " << jointFactorPos << " comes from factor's slot " << factorVarSlot << std::endl;
|
||||||
|
++ factorVarSlot;
|
||||||
|
}
|
||||||
|
++ jointFactorPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <CppUnitLite/TestHarness.h>
|
#include <CppUnitLite/TestHarness.h>
|
||||||
#include <gtsam/base/TestableAssertions.h>
|
#include <gtsam/base/TestableAssertions.h>
|
||||||
|
|
||||||
#include <gtsam/inference/VariableSlots-inl.h>
|
#include <gtsam/inference/VariableSlots.h>
|
||||||
#include <gtsam/inference/SymbolicFactorGraph.h>
|
#include <gtsam/inference/SymbolicFactorGraph.h>
|
||||||
|
|
||||||
#include <boost/assign/std/vector.hpp>
|
#include <boost/assign/std/vector.hpp>
|
||||||
|
|
Loading…
Reference in New Issue