diff --git a/gtsam/inference/FactorGraph-inl.h b/gtsam/inference/FactorGraph-inl.h index b7c3f81a5..8da4465d5 100644 --- a/gtsam/inference/FactorGraph-inl.h +++ b/gtsam/inference/FactorGraph-inl.h @@ -101,7 +101,7 @@ namespace gtsam { typename DERIVED::shared_ptr Combine(const FactorGraph& factors, const FastMap >& variableSlots) { - typedef const pair > KeySlotPair; + typedef const std::pair > KeySlotPair; // Local functional for getting keys out of key-value pairs struct Local { static KEY FirstOf(const KeySlotPair& pr) { return pr.first; } }; diff --git a/gtsam/inference/SymbolicFactorGraph.cpp b/gtsam/inference/SymbolicFactorGraph.cpp index 2d5190f45..2ae0b483a 100644 --- a/gtsam/inference/SymbolicFactorGraph.cpp +++ b/gtsam/inference/SymbolicFactorGraph.cpp @@ -67,8 +67,7 @@ namespace gtsam { IndexFactor::shared_ptr CombineSymbolic( const FactorGraph& factors, const FastMap >& variableSlots) { - IndexFactor::shared_ptr combined(Combine (factors, - variableSlots)); + IndexFactor::shared_ptr combined(Combine (factors, variableSlots)); // combined->assertInvariants(); return combined; } diff --git a/gtsam/inference/graph-inl.h b/gtsam/inference/graph-inl.h index 195e18d73..73980797a 100644 --- a/gtsam/inference/graph-inl.h +++ b/gtsam/inference/graph-inl.h @@ -70,7 +70,7 @@ SDGraph toBoostGraph(const G& graph) { for(itFactor=graph.begin(); itFactor!=graph.end(); itFactor++) { if ((*itFactor)->keys().size() > 2) - throw(invalid_argument("toBoostGraph: only support factors with at most two keys")); + throw(std::invalid_argument("toBoostGraph: only support factors with at most two keys")); if ((*itFactor)->keys().size() == 1) continue; @@ -131,7 +131,7 @@ predecessorMap2Graph(const PredecessorMap& p_map) { } if (!foundRoot) - throw invalid_argument("predecessorMap2Graph: invalid predecessor map!"); + throw std::invalid_argument("predecessorMap2Graph: invalid predecessor map!"); else return boost::tuple >(g, root, key2vertex); } @@ -171,7 +171,7 @@ boost::shared_ptr composePoses(const G& graph, const PredecessorMap PoseGraph g; PoseVertex root; - map key2vertex; + std::map key2vertex; boost::tie(g, root, key2vertex) = predecessorMap2Graph(tree); @@ -181,7 +181,7 @@ boost::shared_ptr composePoses(const G& graph, const PredecessorMap BOOST_FOREACH(typename G::sharedFactor nl_factor, graph) { if (nl_factor->keys().size() > 2) - throw invalid_argument("composePoses: only support factors with at most two keys"); + throw std::invalid_argument("composePoses: only support factors with at most two keys"); // e.g. in pose2graph, nonlinear factor needs to be converted to pose2factor boost::shared_ptr factor = boost::dynamic_pointer_cast(nl_factor); @@ -196,7 +196,7 @@ boost::shared_ptr composePoses(const G& graph, const PredecessorMap POSE l1Xl2 = factor->measured(); boost::tie(edge12, found1) = boost::edge(v1, v2, g); boost::tie(edge21, found2) = boost::edge(v2, v1, g); - if (found1 && found2) throw invalid_argument ("composePoses: invalid spanning tree"); + if (found1 && found2) throw std::invalid_argument ("composePoses: invalid spanning tree"); if (!found1 && !found2) continue; if (found1) boost::put(boost::edge_weight, g, edge12, l1Xl2); @@ -223,13 +223,13 @@ PredecessorMap findMinimumSpanningTree(const G& fg) { SDGraph g = gtsam::toBoostGraph(fg); // find minimum spanning tree - vector::Vertex> p_map(boost::num_vertices(g)); + std::vector::Vertex> p_map(boost::num_vertices(g)); prim_minimum_spanning_tree(g, &p_map[0]); // convert edge to string pairs PredecessorMap tree; typename SDGraph::vertex_iterator itVertex = boost::vertices(g).first; - typename vector::Vertex>::iterator vi; + typename std::vector::Vertex>::iterator vi; for (vi = p_map.begin(); vi != p_map.end(); itVertex++, vi++) { KEY key = boost::get(boost::vertex_name, g, *itVertex); KEY parent = boost::get(boost::vertex_name, g, *vi); @@ -248,7 +248,7 @@ void split(const G& g, const PredecessorMap& tree, G& Ab1, G& Ab2) { BOOST_FOREACH(const F& factor, g) { if (factor->keys().size() > 2) - throw(invalid_argument("split: only support factors with at most two keys")); + throw(std::invalid_argument("split: only support factors with at most two keys")); if (factor->keys().size() == 1) { Ab1.push_back(factor); diff --git a/gtsam/nonlinear/DoglegOptimizerImpl.h b/gtsam/nonlinear/DoglegOptimizerImpl.h index 737aa2f66..27a8d47ec 100644 --- a/gtsam/nonlinear/DoglegOptimizerImpl.h +++ b/gtsam/nonlinear/DoglegOptimizerImpl.h @@ -176,7 +176,7 @@ typename DoglegOptimizerImpl::IterationResult DoglegOptimizerImpl::Iterate( result.dx_d = ComputeDoglegPoint(Delta, dx_u, dx_n, verbose); toc(3, "Dog leg point"); - if(verbose) cout << "Delta = " << Delta << ", dx_d_norm = " << result.dx_d.vector().norm() << endl; + if(verbose) std::cout << "Delta = " << Delta << ", dx_d_norm = " << result.dx_d.vector().norm() << std::endl; tic(4, "retract"); // Compute expmapped solution @@ -193,8 +193,8 @@ typename DoglegOptimizerImpl::IterationResult DoglegOptimizerImpl::Iterate( const double new_M_error = jfg.error(result.dx_d); toc(6, "decrease in M"); - if(verbose) cout << setprecision(15) << "f error: " << f_error << " -> " << result.f_error << endl; - if(verbose) cout << setprecision(15) << "M error: " << M_error << " -> " << new_M_error << endl; + if(verbose) std::cout << std::setprecision(15) << "f error: " << f_error << " -> " << result.f_error << std::endl; + if(verbose) std::cout << std::setprecision(15) << "M error: " << M_error << " -> " << new_M_error << std::endl; tic(7, "adjust Delta"); // Compute gain ratio. Here we take advantage of the invariant that the @@ -203,7 +203,7 @@ typename DoglegOptimizerImpl::IterationResult DoglegOptimizerImpl::Iterate( 0.5 : (f_error - result.f_error) / (M_error - new_M_error); - if(verbose) cout << setprecision(15) << "rho = " << rho << endl; + if(verbose) std::cout << std::setprecision(15) << "rho = " << rho << std::endl; if(rho >= 0.75) { // M agrees very well with f, so try to increase lambda @@ -253,7 +253,7 @@ typename DoglegOptimizerImpl::IterationResult DoglegOptimizerImpl::Iterate( stay = true; lastAction = DECREASED_DELTA; } else { - if(verbose) cout << "Warning: Dog leg stopping because cannot decrease error with minimum Delta" << endl; + if(verbose) std::cout << "Warning: Dog leg stopping because cannot decrease error with minimum Delta" << std::endl; stay = false; } } diff --git a/gtsam_unstable/linear/iterative-inl.h b/gtsam_unstable/linear/iterative-inl.h index c91e6f68a..aa7eb076b 100644 --- a/gtsam_unstable/linear/iterative-inl.h +++ b/gtsam_unstable/linear/iterative-inl.h @@ -50,7 +50,7 @@ namespace gtsam { // init gamma and calculate threshold gamma = dot(g,g) ; - threshold = ::max(parameters_.epsilon_abs(), parameters_.epsilon() * parameters_.epsilon() * gamma); + threshold = std::max(parameters_.epsilon_abs(), parameters_.epsilon() * parameters_.epsilon() * gamma); // Allocate and calculate A*d for first iteration if (gamma > parameters_.epsilon_abs()) Ad = Ab * d; @@ -59,10 +59,10 @@ namespace gtsam { /* ************************************************************************* */ // print void print(const V& x) { - cout << "iteration = " << k << endl; + std::cout << "iteration = " << k << std::endl; gtsam::print(x,"x"); gtsam::print(g, "g"); - cout << "dotg = " << gamma << endl; + std::cout << "dotg = " << gamma << std::endl; gtsam::print(d, "d"); gtsam::print(Ad, "Ad"); } @@ -92,8 +92,8 @@ namespace gtsam { // check for convergence double new_gamma = dot(g, g); if (parameters_.verbosity() != IterativeOptimizationParameters::SILENT) - cout << "iteration " << k << ": alpha = " << alpha - << ", dotg = " << new_gamma << endl; + std::cout << "iteration " << k << ": alpha = " << alpha + << ", dotg = " << new_gamma << std::endl; if (new_gamma < threshold) return true; // calculate new search direction @@ -126,14 +126,14 @@ namespace gtsam { CGState state(Ab, x, parameters, steepest); if (parameters.verbosity() != IterativeOptimizationParameters::SILENT) - cout << "CG: epsilon = " << parameters.epsilon() + std::cout << "CG: epsilon = " << parameters.epsilon() << ", maxIterations = " << parameters.maxIterations() << ", ||g0||^2 = " << state.gamma - << ", threshold = " << state.threshold << endl; + << ", threshold = " << state.threshold << std::endl; if ( state.gamma < state.threshold ) { if (parameters.verbosity() != IterativeOptimizationParameters::SILENT) - cout << "||g0||^2 < threshold, exiting immediately !" << endl; + std::cout << "||g0||^2 < threshold, exiting immediately !" << std::endl; return x; }