28 #include <boost/foreach.hpp>
29 #include <boost/tuple/tuple.hpp>
58 GTSAM_EXPORT
static const size_t Empty;
77 GTSAM_EXPORT
void print(
const std::string& str =
"VariableSlots: ")
const;
89 gttic(VariableSlots_constructor);
90 static const bool debug =
false;
98 size_t jointFactorPos = 0;
99 BOOST_FOREACH(
const typename FG::sharedFactor& factor, factorGraph) {
101 size_t factorVarSlot = 0;
102 BOOST_FOREACH(
const Key involvedVariable, *factor) {
109 iterator thisVarSlots;
bool inserted;
110 boost::tie(thisVarSlots, inserted) = this->insert(std::make_pair(involvedVariable,
FastVector<size_t>()));
112 thisVarSlots->second.resize(factorGraph.size(), Empty);
113 thisVarSlots->second[jointFactorPos] = factorVarSlot;
114 if(debug) std::cout <<
" var " << involvedVariable <<
" rowblock " << jointFactorPos <<
" comes from factor's slot " << factorVarSlot << std::endl;
GTSAM_EXPORT void print(const std::string &str="VariableSlots: ") const
print
Definition: VariableSlots.cpp:30
A combined factor is assembled as one block of rows for each component factor.
Definition: VariableSlots.h:53
Included from all GTSAM files.
A thin wrapper around std::map that uses boost's fast_pool_allocator.
GTSAM_EXPORT bool equals(const VariableSlots &rhs, double tol=0.0) const
equals
Definition: VariableSlots.cpp:53
VariableSlots(const FG &factorGraph)
Constructor from a set of factors to be combined.
Definition: VariableSlots.h:87
size_t Key
Integer nonlinear key type.
Definition: types.h:59
A thin wrapper around std::vector that uses boost's pool_allocator.