diff --git a/gtsam/base/treeTraversal-inst.h b/gtsam/base/treeTraversal-inst.h index 5ac1a55a9..318091492 100644 --- a/gtsam/base/treeTraversal-inst.h +++ b/gtsam/base/treeTraversal-inst.h @@ -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 { } } -} \ No newline at end of file +} diff --git a/gtsam/inference/BayesTree-inst.h b/gtsam/inference/BayesTree-inst.h index 0a238267b..b1363c70a 100644 --- a/gtsam/inference/BayesTree-inst.h +++ b/gtsam/inference/BayesTree-inst.h @@ -229,7 +229,7 @@ namespace gtsam { boost::shared_ptr rootContainer = boost::make_shared(); treeTraversal::DepthFirstForest(other, rootContainer, BayesTreeCloneForestVisitorPre); 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::removeClique(sharedClique clique) { if (clique->isRoot()) { - std::vector::iterator root = std::find(roots_.begin(), roots_.end(), clique); + typename std::vector::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); diff --git a/gtsam/inference/BayesTree.h b/gtsam/inference/BayesTree.h index 0d9604082..feca43fd2 100644 --- a/gtsam/inference/BayesTree.h +++ b/gtsam/inference/BayesTree.h @@ -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()); } }; diff --git a/gtsam/inference/BayesTreeCliqueBase-inst.h b/gtsam/inference/BayesTreeCliqueBase-inst.h index 810338c57..90ca98863 100644 --- a/gtsam/inference/BayesTreeCliqueBase-inst.h +++ b/gtsam/inference/BayesTreeCliqueBase-inst.h @@ -25,7 +25,7 @@ namespace gtsam { /* ************************************************************************* */ template bool BayesTreeCliqueBase::equals( - const DERIVED& other, double tol = 1e-9) const + const DERIVED& other, double tol) const { return (!conditional_ && !other.conditional()) || conditional_->equals(*other.conditional(), tol); diff --git a/gtsam/inference/BayesTreeCliqueBase.h b/gtsam/inference/BayesTreeCliqueBase.h index 1e505f6cd..acf8156ab 100644 --- a/gtsam/inference/BayesTreeCliqueBase.h +++ b/gtsam/inference/BayesTreeCliqueBase.h @@ -17,6 +17,7 @@ #pragma once +#include #include namespace gtsam { diff --git a/gtsam/inference/Conditional-inst.h b/gtsam/inference/Conditional-inst.h index 4069a6e2a..a22f290d9 100644 --- a/gtsam/inference/Conditional-inst.h +++ b/gtsam/inference/Conditional-inst.h @@ -40,7 +40,7 @@ namespace gtsam { /* ************************************************************************* */ template - bool Conditional::equals(const This& c, double tol = 1e-9) const + bool Conditional::equals(const This& c, double tol) const { return nrFrontals_ == c.nrFrontals_; } diff --git a/gtsam/inference/EliminateableFactorGraph-inst.h b/gtsam/inference/EliminateableFactorGraph-inst.h index 33a5d7b47..d75017ac8 100644 --- a/gtsam/inference/EliminateableFactorGraph-inst.h +++ b/gtsam/inference/EliminateableFactorGraph-inst.h @@ -143,8 +143,7 @@ namespace gtsam { EliminateableFactorGraph::marginalMultifrontalBayesNet( boost::variant&> 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::marginalMultifrontalBayesTree( boost::variant&> 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 EliminateableFactorGraph::marginal( const std::vector& variables, - const Eliminate& function = EliminationTraitsType::DefaultEliminate, - OptionalVariableIndex variableIndex = boost::none) const + const Eliminate& function, OptionalVariableIndex variableIndex) const { if(variableIndex) { diff --git a/gtsam/inference/EliminationTree-inst.h b/gtsam/inference/EliminationTree-inst.h index f4b77efa7..1ce98a435 100644 --- a/gtsam/inference/EliminationTree-inst.h +++ b/gtsam/inference/EliminationTree-inst.h @@ -221,13 +221,13 @@ namespace gtsam { { FastMap keys; BOOST_FOREACH(const sharedNode& root, this->roots_) { keys.insert(std::make_pair(root->key, root)); } - typedef FastMap::value_type Key_Node; + typedef typename FastMap::value_type Key_Node; BOOST_FOREACH(const Key_Node& key_node, keys) { stack1.push(key_node.second); } } { FastMap keys; BOOST_FOREACH(const sharedNode& root, expected.roots_) { keys.insert(std::make_pair(root->key, root)); } - typedef FastMap::value_type Key_Node; + typedef typename FastMap::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 keys; BOOST_FOREACH(const sharedNode& node, node1->children) { keys.insert(std::make_pair(node->key, node)); } - typedef FastMap::value_type Key_Node; + typedef typename FastMap::value_type Key_Node; BOOST_FOREACH(const Key_Node& key_node, keys) { stack1.push(key_node.second); } } { FastMap keys; BOOST_FOREACH(const sharedNode& node, node2->children) { keys.insert(std::make_pair(node->key, node)); } - typedef FastMap::value_type Key_Node; + typedef typename FastMap::value_type Key_Node; BOOST_FOREACH(const Key_Node& key_node, keys) { stack2.push(key_node.second); } } } diff --git a/gtsam/inference/ISAM.h b/gtsam/inference/ISAM.h index 057173e0f..d920be209 100644 --- a/gtsam/inference/ISAM.h +++ b/gtsam/inference/ISAM.h @@ -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; diff --git a/gtsam/inference/Ordering.cpp b/gtsam/inference/Ordering.cpp index eeb81e067..b0ac9669f 100644 --- a/gtsam/inference/Ordering.cpp +++ b/gtsam/inference/Ordering.cpp @@ -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(variableIndex.size(), 0)); + vector dummy_groups(variableIndex.size(), 0); + return Ordering::COLAMDConstrained(variableIndex, dummy_groups); } /* ************************************************************************* */