Merging
parent
db287b0d73
commit
dde245ef3b
|
|
@ -204,7 +204,7 @@ namespace gtsam {
|
|||
|
||||
// Add roots to stack (insert such that they are visited and processed in order
|
||||
{
|
||||
Stack::iterator insertLocation = stack.begin();
|
||||
typename Stack::iterator insertLocation = stack.begin();
|
||||
BOOST_FOREACH(const sharedNode& root, forest.roots())
|
||||
stack.insert(insertLocation, TraversalNode(root, rootData));
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ namespace gtsam {
|
|||
// If not already visited, visit the node and add its children (use reverse iterators so
|
||||
// children are processed in the order they appear)
|
||||
node.dataPointer = dataList.insert(dataList.end(), visitorPre(node.treeNode, node.parentData));
|
||||
Stack::iterator insertLocation = stack.begin();
|
||||
typename Stack::iterator insertLocation = stack.begin();
|
||||
BOOST_FOREACH(const sharedNode& child, node.treeNode->children)
|
||||
stack.insert(insertLocation, TraversalNode(child, *node.dataPointer));
|
||||
node.expanded = true;
|
||||
|
|
@ -331,4 +331,4 @@ namespace gtsam {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ namespace gtsam {
|
|||
boost::shared_ptr<Clique> rootContainer = boost::make_shared<Clique>();
|
||||
treeTraversal::DepthFirstForest(other, rootContainer, BayesTreeCloneForestVisitorPre<Clique>);
|
||||
BOOST_FOREACH(const sharedClique& root, rootContainer->children) {
|
||||
root->parent_ = Clique::weak_ptr(); // Reset the parent since it's set to the dummy clique
|
||||
root->parent_ = typename Clique::weak_ptr(); // Reset the parent since it's set to the dummy clique
|
||||
insertRoot(root);
|
||||
}
|
||||
return *this;
|
||||
|
|
@ -437,7 +437,7 @@ namespace gtsam {
|
|||
void BayesTree<CLIQUE>::removeClique(sharedClique clique)
|
||||
{
|
||||
if (clique->isRoot()) {
|
||||
std::vector<sharedClique>::iterator root = std::find(roots_.begin(), roots_.end(), clique);
|
||||
typename std::vector<sharedClique>::iterator root = std::find(roots_.begin(), roots_.end(), clique);
|
||||
if(root != roots_.end())
|
||||
roots_.erase(root);
|
||||
} else { // detach clique from parent
|
||||
|
|
@ -490,7 +490,7 @@ namespace gtsam {
|
|||
{
|
||||
// get the clique
|
||||
// TODO: Nodes will be searched again in removeClique
|
||||
Nodes::const_iterator node = nodes_.find(j);
|
||||
typename Nodes::const_iterator node = nodes_.find(j);
|
||||
if(node != nodes_.end()) {
|
||||
// remove path from clique to root
|
||||
this->removePath(node->second, bn, orphans);
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ namespace gtsam {
|
|||
|
||||
/** alternate syntax for matlab: find the clique that contains the variable with Index j */
|
||||
const sharedClique& clique(Key j) const {
|
||||
Nodes::const_iterator c = nodes_.find(j);
|
||||
typename Nodes::const_iterator c = nodes_.find(j);
|
||||
if(c == nodes_.end())
|
||||
throw std::out_of_range("Requested the BayesTree clique for a key that is not in the BayesTree");
|
||||
else
|
||||
|
|
@ -272,7 +272,7 @@ namespace gtsam {
|
|||
{
|
||||
// Store parent keys in our base type factor so that eliminating those parent keys will pull
|
||||
// this subtree into the elimination.
|
||||
keys_.assign(clique->conditional()->beginParents(), clique->conditional()->endParents());
|
||||
this->keys_.assign(clique->conditional()->beginParents(), clique->conditional()->endParents());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace gtsam {
|
|||
/* ************************************************************************* */
|
||||
template<class DERIVED, class FACTORGRAPH>
|
||||
bool BayesTreeCliqueBase<DERIVED, FACTORGRAPH>::equals(
|
||||
const DERIVED& other, double tol = 1e-9) const
|
||||
const DERIVED& other, double tol) const
|
||||
{
|
||||
return (!conditional_ && !other.conditional())
|
||||
|| conditional_->equals(*other.conditional(), tol);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <gtsam/base/types.h>
|
||||
|
||||
namespace gtsam {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace gtsam {
|
|||
|
||||
/* ************************************************************************* */
|
||||
template<class FACTOR, class DERIVEDFACTOR>
|
||||
bool Conditional<FACTOR,DERIVEDFACTOR>::equals(const This& c, double tol = 1e-9) const
|
||||
bool Conditional<FACTOR,DERIVEDFACTOR>::equals(const This& c, double tol) const
|
||||
{
|
||||
return nrFrontals_ == c.nrFrontals_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,8 +143,7 @@ namespace gtsam {
|
|||
EliminateableFactorGraph<FACTORGRAPH>::marginalMultifrontalBayesNet(
|
||||
boost::variant<const Ordering&, const std::vector<Key>&> variables,
|
||||
OptionalOrdering marginalizedVariableOrdering,
|
||||
const Eliminate& function = EliminationTraitsType::DefaultEliminate,
|
||||
OptionalVariableIndex variableIndex = boost::none) const
|
||||
const Eliminate& function, OptionalVariableIndex variableIndex) const
|
||||
{
|
||||
if(variableIndex)
|
||||
{
|
||||
|
|
@ -200,8 +199,7 @@ namespace gtsam {
|
|||
EliminateableFactorGraph<FACTORGRAPH>::marginalMultifrontalBayesTree(
|
||||
boost::variant<const Ordering&, const std::vector<Key>&> variables,
|
||||
OptionalOrdering marginalizedVariableOrdering,
|
||||
const Eliminate& function = EliminationTraitsType::DefaultEliminate,
|
||||
OptionalVariableIndex variableIndex = boost::none) const
|
||||
const Eliminate& function, OptionalVariableIndex variableIndex) const
|
||||
{
|
||||
if(variableIndex)
|
||||
{
|
||||
|
|
@ -256,8 +254,7 @@ namespace gtsam {
|
|||
boost::shared_ptr<FACTORGRAPH>
|
||||
EliminateableFactorGraph<FACTORGRAPH>::marginal(
|
||||
const std::vector<Key>& variables,
|
||||
const Eliminate& function = EliminationTraitsType::DefaultEliminate,
|
||||
OptionalVariableIndex variableIndex = boost::none) const
|
||||
const Eliminate& function, OptionalVariableIndex variableIndex) const
|
||||
{
|
||||
if(variableIndex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -221,13 +221,13 @@ namespace gtsam {
|
|||
{
|
||||
FastMap<Key,sharedNode> keys;
|
||||
BOOST_FOREACH(const sharedNode& root, this->roots_) { keys.insert(std::make_pair(root->key, root)); }
|
||||
typedef FastMap<Key,sharedNode>::value_type Key_Node;
|
||||
typedef typename FastMap<Key,sharedNode>::value_type Key_Node;
|
||||
BOOST_FOREACH(const Key_Node& key_node, keys) { stack1.push(key_node.second); }
|
||||
}
|
||||
{
|
||||
FastMap<Key,sharedNode> keys;
|
||||
BOOST_FOREACH(const sharedNode& root, expected.roots_) { keys.insert(std::make_pair(root->key, root)); }
|
||||
typedef FastMap<Key,sharedNode>::value_type Key_Node;
|
||||
typedef typename FastMap<Key,sharedNode>::value_type Key_Node;
|
||||
BOOST_FOREACH(const Key_Node& key_node, keys) { stack2.push(key_node.second); }
|
||||
}
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ namespace gtsam {
|
|||
if(node1->factors.size() != node2->factors.size()) {
|
||||
return false;
|
||||
} else {
|
||||
for(Node::Factors::const_iterator it1 = node1->factors.begin(), it2 = node2->factors.begin();
|
||||
for(typename Node::Factors::const_iterator it1 = node1->factors.begin(), it2 = node2->factors.begin();
|
||||
it1 != node1->factors.end(); ++it1, ++it2) // Only check it1 == end because we already returned false for different counts
|
||||
{
|
||||
if(*it1 && *it2) {
|
||||
|
|
@ -261,13 +261,13 @@ namespace gtsam {
|
|||
{
|
||||
FastMap<Key,sharedNode> keys;
|
||||
BOOST_FOREACH(const sharedNode& node, node1->children) { keys.insert(std::make_pair(node->key, node)); }
|
||||
typedef FastMap<Key,sharedNode>::value_type Key_Node;
|
||||
typedef typename FastMap<Key,sharedNode>::value_type Key_Node;
|
||||
BOOST_FOREACH(const Key_Node& key_node, keys) { stack1.push(key_node.second); }
|
||||
}
|
||||
{
|
||||
FastMap<Key,sharedNode> keys;
|
||||
BOOST_FOREACH(const sharedNode& node, node2->children) { keys.insert(std::make_pair(node->key, node)); }
|
||||
typedef FastMap<Key,sharedNode>::value_type Key_Node;
|
||||
typedef typename FastMap<Key,sharedNode>::value_type Key_Node;
|
||||
BOOST_FOREACH(const Key_Node& key_node, keys) { stack2.push(key_node.second); }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,10 @@ namespace gtsam {
|
|||
private:
|
||||
|
||||
typedef BAYESTREE Base;
|
||||
typedef typename Base::BayesNetType BayesNetType;
|
||||
typedef typename Base::FactorGraphType FactorGraphType;
|
||||
typedef typename Base::Clique Clique;
|
||||
typedef typename Base::sharedClique sharedClique;
|
||||
typedef typename Base::Cliques Cliques;
|
||||
typedef typename Base::Eliminate Eliminate;
|
||||
typedef typename Base::EliminationTraitsType EliminationTraitsType;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ namespace gtsam {
|
|||
Ordering Ordering::COLAMD(const VariableIndex& variableIndex)
|
||||
{
|
||||
// Call constrained version with all groups set to zero
|
||||
return Ordering::COLAMDConstrained(variableIndex, vector<int>(variableIndex.size(), 0));
|
||||
vector<int> dummy_groups(variableIndex.size(), 0);
|
||||
return Ordering::COLAMDConstrained(variableIndex, dummy_groups);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
Loading…
Reference in New Issue