Clang-Tidy fixes Change-Id: I58900a452591315a39754b329e94b315c34926cd
diff --git a/examples/robot_pose_mle.cc b/examples/robot_pose_mle.cc index 7dd981d..728c9c2 100644 --- a/examples/robot_pose_mle.cc +++ b/examples/robot_pose_mle.cc
@@ -125,6 +125,7 @@ // will be computed by a DynamicAutoDiffCostFunction since the number of // odometry observations will only be known at run time. +#include <algorithm> #include <cmath> #include <cstdio> #include <random>
diff --git a/internal/ceres/block_jacobian_writer.cc b/internal/ceres/block_jacobian_writer.cc index 4f1834a..544e913 100644 --- a/internal/ceres/block_jacobian_writer.cc +++ b/internal/ceres/block_jacobian_writer.cc
@@ -32,6 +32,7 @@ #include <algorithm> #include <memory> +#include <vector> #include "ceres/block_evaluate_preparer.h" #include "ceres/block_sparse_matrix.h"
diff --git a/internal/ceres/callbacks.cc b/internal/ceres/callbacks.cc index 79f35e0..1fab385 100644 --- a/internal/ceres/callbacks.cc +++ b/internal/ceres/callbacks.cc
@@ -32,6 +32,7 @@ #include <algorithm> #include <iostream> // NO LINT +#include <string> #include "ceres/program.h" #include "ceres/stringprintf.h"
diff --git a/internal/ceres/canonical_views_clustering.cc b/internal/ceres/canonical_views_clustering.cc index aec2cb1..2a2810f 100644 --- a/internal/ceres/canonical_views_clustering.cc +++ b/internal/ceres/canonical_views_clustering.cc
@@ -33,6 +33,7 @@ #include <unordered_map> #include <unordered_set> +#include <vector> #include "ceres/graph.h" #include "ceres/internal/export.h" @@ -62,7 +63,7 @@ private: void FindValidViews(IntSet* valid_views) const; double ComputeClusteringQualityDifference( - const int candidate, const std::vector<int>& centers) const; + int candidate, const std::vector<int>& centers) const; void UpdateCanonicalViewAssignments(const int canonical_view); void ComputeClusterMembership(const std::vector<int>& centers, IntMap* membership) const;
diff --git a/internal/ceres/coordinate_descent_minimizer.cc b/internal/ceres/coordinate_descent_minimizer.cc index 8087a58..3abbefb 100644 --- a/internal/ceres/coordinate_descent_minimizer.cc +++ b/internal/ceres/coordinate_descent_minimizer.cc
@@ -32,8 +32,11 @@ #include <algorithm> #include <iterator> +#include <map> #include <memory> #include <numeric> +#include <set> +#include <string> #include <vector> #include "ceres/evaluator.h" @@ -69,6 +72,9 @@ // Serialize the OrderedGroups into a vector of parameter block // offsets for parallel access. + + // TODO(sameeragarwal): Investigate if parameter_block_index should be an + // ordered or an unordered container. std::map<ParameterBlock*, int> parameter_block_index; std::map<int, std::set<double*>> group_to_elements = ordering.group_to_elements(); @@ -234,6 +240,8 @@ const Program& program, const ParameterBlockOrdering& ordering, std::string* message) { + // TODO(sameeragarwal): Investigate if this should be an ordered or an + // unordered group. const std::map<int, std::set<double*>>& group_to_elements = ordering.group_to_elements();
diff --git a/internal/ceres/cost_function_to_functor_test.cc b/internal/ceres/cost_function_to_functor_test.cc index 0d1e901..c02e0e4 100644 --- a/internal/ceres/cost_function_to_functor_test.cc +++ b/internal/ceres/cost_function_to_functor_test.cc
@@ -32,6 +32,7 @@ #include <cstdint> #include <memory> +#include <vector> #include "ceres/autodiff_cost_function.h" #include "ceres/dynamic_autodiff_cost_function.h"
diff --git a/internal/ceres/covariance_test.cc b/internal/ceres/covariance_test.cc index 7d477a7..8455721 100644 --- a/internal/ceres/covariance_test.cc +++ b/internal/ceres/covariance_test.cc
@@ -36,6 +36,7 @@ #include <map> #include <memory> #include <utility> +#include <vector> #include "ceres/autodiff_cost_function.h" #include "ceres/compressed_row_sparse_matrix.h" @@ -404,6 +405,8 @@ class CovarianceTest : public ::testing::Test { protected: + // TODO(sameeragarwal): Investigate if this should be an ordered or an + // unordered map. using BoundsMap = std::map<const double*, std::pair<int, int>>; void SetUp() override {
diff --git a/internal/ceres/dynamic_autodiff_cost_function_test.cc b/internal/ceres/dynamic_autodiff_cost_function_test.cc index d4800c2..7b2239c 100644 --- a/internal/ceres/dynamic_autodiff_cost_function_test.cc +++ b/internal/ceres/dynamic_autodiff_cost_function_test.cc
@@ -34,6 +34,7 @@ #include <cstddef> #include <memory> +#include <vector> #include "gtest/gtest.h"
diff --git a/internal/ceres/dynamic_compressed_row_jacobian_writer.cc b/internal/ceres/dynamic_compressed_row_jacobian_writer.cc index 78d1875..f84f44a 100644 --- a/internal/ceres/dynamic_compressed_row_jacobian_writer.cc +++ b/internal/ceres/dynamic_compressed_row_jacobian_writer.cc
@@ -31,6 +31,8 @@ #include "ceres/dynamic_compressed_row_jacobian_writer.h" #include <memory> +#include <utility> +#include <vector> #include "ceres/casts.h" #include "ceres/compressed_row_jacobian_writer.h"
diff --git a/internal/ceres/dynamic_compressed_row_sparse_matrix_test.cc b/internal/ceres/dynamic_compressed_row_sparse_matrix_test.cc index c32233c..b4f7cd9 100644 --- a/internal/ceres/dynamic_compressed_row_sparse_matrix_test.cc +++ b/internal/ceres/dynamic_compressed_row_sparse_matrix_test.cc
@@ -31,6 +31,7 @@ #include "ceres/dynamic_compressed_row_sparse_matrix.h" #include <memory> +#include <vector> #include "ceres/casts.h" #include "ceres/compressed_row_sparse_matrix.h"
diff --git a/internal/ceres/dynamic_numeric_diff_cost_function_test.cc b/internal/ceres/dynamic_numeric_diff_cost_function_test.cc index 0dae837..f9ae2ee 100644 --- a/internal/ceres/dynamic_numeric_diff_cost_function_test.cc +++ b/internal/ceres/dynamic_numeric_diff_cost_function_test.cc
@@ -33,6 +33,7 @@ #include <cstddef> #include <memory> +#include <vector> #include "gtest/gtest.h"
diff --git a/internal/ceres/evaluator_test.cc b/internal/ceres/evaluator_test.cc index d9a1b21..34ec78c 100644 --- a/internal/ceres/evaluator_test.cc +++ b/internal/ceres/evaluator_test.cc
@@ -34,6 +34,8 @@ #include "ceres/evaluator.h" #include <memory> +#include <string> +#include <vector> #include "ceres/casts.h" #include "ceres/cost_function.h"
diff --git a/internal/ceres/file.cc b/internal/ceres/file.cc index 5874cd7..a5338d5 100644 --- a/internal/ceres/file.cc +++ b/internal/ceres/file.cc
@@ -33,6 +33,7 @@ #include "ceres/file.h" #include <cstdio> +#include <string> #include "glog/logging.h"
diff --git a/internal/ceres/gradient_problem_solver.cc b/internal/ceres/gradient_problem_solver.cc index 3438409..e4c96aa 100644 --- a/internal/ceres/gradient_problem_solver.cc +++ b/internal/ceres/gradient_problem_solver.cc
@@ -30,6 +30,7 @@ #include "ceres/gradient_problem_solver.h" +#include <map> #include <memory> #include <string>
diff --git a/internal/ceres/graph_algorithms_test.cc b/internal/ceres/graph_algorithms_test.cc index ac56497..ddd6914 100644 --- a/internal/ceres/graph_algorithms_test.cc +++ b/internal/ceres/graph_algorithms_test.cc
@@ -33,6 +33,7 @@ #include <algorithm> #include <memory> #include <unordered_set> +#include <vector> #include "ceres/graph.h" #include "ceres/internal/export.h"
diff --git a/internal/ceres/line_search.cc b/internal/ceres/line_search.cc index 2b6fe4d..036c739 100644 --- a/internal/ceres/line_search.cc +++ b/internal/ceres/line_search.cc
@@ -33,8 +33,11 @@ #include <algorithm> #include <cmath> #include <iomanip> -#include <iostream> // NOLINT +#include <map> #include <memory> +#include <ostream> // NOLINT +#include <string> +#include <vector> #include "ceres/evaluator.h" #include "ceres/function_sample.h"
diff --git a/internal/ceres/parameter_block_ordering.cc b/internal/ceres/parameter_block_ordering.cc index 669d5fd..753f9c9 100644 --- a/internal/ceres/parameter_block_ordering.cc +++ b/internal/ceres/parameter_block_ordering.cc
@@ -30,8 +30,11 @@ #include "ceres/parameter_block_ordering.h" +#include <map> #include <memory> +#include <set> #include <unordered_set> +#include <vector> #include "ceres/graph.h" #include "ceres/graph_algorithms.h" @@ -164,6 +167,8 @@ return; } + // TODO(sameeragarwal): Investigate if this should be a set or an + // unordered_set. const std::map<int, std::set<double*>>& group_to_elements = ordering->group_to_elements(); for (const auto& g_t_e : group_to_elements) {
diff --git a/internal/ceres/polynomial_test.cc b/internal/ceres/polynomial_test.cc index ea701b0..c214f0f 100644 --- a/internal/ceres/polynomial_test.cc +++ b/internal/ceres/polynomial_test.cc
@@ -35,6 +35,7 @@ #include <cmath> #include <cstddef> #include <limits> +#include <vector> #include "ceres/function_sample.h" #include "ceres/test_util.h"
diff --git a/internal/ceres/problem_test.cc b/internal/ceres/problem_test.cc index a3f26dd..70a8469 100644 --- a/internal/ceres/problem_test.cc +++ b/internal/ceres/problem_test.cc
@@ -32,6 +32,8 @@ #include "ceres/problem.h" #include <memory> +#include <string> +#include <vector> #include "ceres/autodiff_cost_function.h" #include "ceres/casts.h"
diff --git a/internal/ceres/reorder_program.cc b/internal/ceres/reorder_program.cc index ad9d0d2..d623b96 100644 --- a/internal/ceres/reorder_program.cc +++ b/internal/ceres/reorder_program.cc
@@ -31,8 +31,11 @@ #include "ceres/reorder_program.h" #include <algorithm> +#include <map> #include <memory> #include <numeric> +#include <set> +#include <string> #include <vector> #include "Eigen/SparseCore" @@ -227,6 +230,8 @@ program->mutable_parameter_blocks(); parameter_blocks->clear(); + // TODO(sameeragarwal): Investigate whether this should be a set or an + // unordered_set. const std::map<int, std::set<double*>>& groups = ordering.group_to_elements(); for (const auto& p : groups) { const std::set<double*>& group = p.second; @@ -484,6 +489,9 @@ // group. // Verify that the first elimination group is an independent set. + + // TODO(sameeragarwal): Investigate if this should be a set or an + // unordered_set. const std::set<double*>& first_elimination_group = parameter_block_ordering->group_to_elements().begin()->second; if (!program->IsParameterBlockSetIndependent(first_elimination_group)) {
diff --git a/internal/ceres/reorder_program_test.cc b/internal/ceres/reorder_program_test.cc index 88f84b6..8cbcf77 100644 --- a/internal/ceres/reorder_program_test.cc +++ b/internal/ceres/reorder_program_test.cc
@@ -31,6 +31,7 @@ #include "ceres/reorder_program.h" #include <random> +#include <vector> #include "ceres/internal/config.h" #include "ceres/parameter_block.h"
diff --git a/internal/ceres/residual_block_test.cc b/internal/ceres/residual_block_test.cc index 0a84248..6845d56 100644 --- a/internal/ceres/residual_block_test.cc +++ b/internal/ceres/residual_block_test.cc
@@ -31,6 +31,8 @@ #include "ceres/residual_block.h" #include <cstdint> +#include <string> +#include <vector> #include "ceres/internal/eigen.h" #include "ceres/manifold.h"
diff --git a/internal/ceres/rotation_test.cc b/internal/ceres/rotation_test.cc index 3191ec5..c5a2016 100644 --- a/internal/ceres/rotation_test.cc +++ b/internal/ceres/rotation_test.cc
@@ -30,6 +30,7 @@ #include "ceres/rotation.h" +#include <algorithm> #include <array> #include <cmath> #include <limits>
diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc index fa07055..688d027 100644 --- a/internal/ceres/solver.cc +++ b/internal/ceres/solver.cc
@@ -32,6 +32,7 @@ #include "ceres/solver.h" #include <algorithm> +#include <map> #include <memory> #include <sstream> // NOLINT #include <string>
diff --git a/internal/ceres/trust_region_preprocessor.cc b/internal/ceres/trust_region_preprocessor.cc index f2da3ac..519f851 100644 --- a/internal/ceres/trust_region_preprocessor.cc +++ b/internal/ceres/trust_region_preprocessor.cc
@@ -32,6 +32,7 @@ #include <numeric> #include <string> +#include <vector> #include "ceres/callbacks.h" #include "ceres/context_impl.h"