22 #include <boost/optional.hpp> 23 #include <boost/shared_ptr.hpp> 29 namespace linearAlgorithms
46 template<
class CLIQUE>
52 const boost::shared_ptr<CLIQUE>& clique,
58 for(
Key parent: clique->conditional_->parents())
70 parentPointers.reserve(clique->conditional()->nrParents());
71 for(
Key parent: clique->conditional()->parents()) {
73 dim += parentPointers.back()->second.size();
80 const Vector& parentVector = parentPointer->second;
81 xS.block(vectorPos,0,parentVector.size(),1) = parentVector.block(0,0,parentVector.size(),1);
82 vectorPos += parentVector.size();
101 auto result = collectedResult.
emplace(*frontal, solution.segment(vectorPosition, c.
getDim(frontal)));
103 throw std::runtime_error(
104 "Internal error while optimizing clique. Trying to insert key '" +
DefaultKeyFormatter(*frontal)
109 vectorPosition += c.
getDim(frontal);
139 template<
class BAYESTREE>
142 gttic(linear_optimizeBayesTree);
148 treeTraversal::no_op postVisitor;
static const KeyFormatter DefaultKeyFormatter
ptrdiff_t DenseIndex
The index type for Eigen objects.
void DepthFirstForestParallel(FOREST &forest, DATA &rootData, VISITOR_PRE &visitorPre, VISITOR_POST &visitorPost, int problemSizeThreshold=10)
const constBVector getb() const
VectorValues collectedResult
FACTOR::const_iterator endFrontals() const
DenseIndex getDim(const_iterator variable) const override
Conditional Gaussian Base class.
VectorValues optimizeBayesTree(const BAYESTREE &bayesTree)
Values::const_iterator const_iterator
Const iterator over vector values.
FastMap< Key, VectorValues::const_iterator > cliqueResults
const mpreal dim(const mpreal &a, const mpreal &b, mp_rnd_t r=mpreal::get_default_rnd())
FACTOR::const_iterator beginFrontals() const
const KeyVector & keys() const
Access the factor's involved variable keys.
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
boost::optional< OptimizeData & > parentData
KeyVector::const_iterator const_iterator
Const iterator over keys.
OptimizeData operator()(const boost::shared_ptr< CLIQUE > &clique, OptimizeData &parentData)
std::pair< VectorValues::iterator, bool > emplace(Key j, Args &&...args)
std::uint64_t Key
Integer nonlinear key type.