From 48068c753e91d77f6c96ef2d529a27ef8ee3947c Mon Sep 17 00:00:00 2001 From: Sameer Agarwal Date: Thu, 28 Aug 2014 13:03:40 -0700 Subject: [PATCH] Lint cleanup from William Rucklidge. Change-Id: Ie0e0aa58440be7a4f67dcd633dbb6f1bb0c051a8 --- docs/source/solving.rst | 2 +- internal/ceres/conjugate_gradients_solver.cc | 2 +- internal/ceres/graph.h | 2 +- internal/ceres/graph_algorithms.h | 6 ------ internal/ceres/single_linkage_clustering_test.cc | 3 ++- internal/ceres/solver.cc | 8 ++++---- internal/ceres/visibility.cc | 5 +++-- internal/ceres/visibility.h | 3 ++- internal/ceres/visibility_based_preconditioner.h | 3 ++- 9 files changed, 16 insertions(+), 18 deletions(-) diff --git a/docs/source/solving.rst b/docs/source/solving.rst index 790d5f3a2..91713e03b 100644 --- a/docs/source/solving.rst +++ b/docs/source/solving.rst @@ -1300,7 +1300,7 @@ elimination group [LiSaad]_. then it is probably best to keep this false, otherwise it will likely lead to worse performance. - This settings affects the `SPARSE_NORMAL_CHOLESKY` solver. + This setting only affects the `SPARSE_NORMAL_CHOLESKY` solver. .. member:: int Solver::Options::min_linear_solver_iterations diff --git a/internal/ceres/conjugate_gradients_solver.cc b/internal/ceres/conjugate_gradients_solver.cc index 3d8eb0a41..56e794640 100644 --- a/internal/ceres/conjugate_gradients_solver.cc +++ b/internal/ceres/conjugate_gradients_solver.cc @@ -114,7 +114,7 @@ LinearSolver::Summary ConjugateGradientsSolver::Solve( double Q0 = -1.0 * xref.dot(bref + r); for (summary.num_iterations = 1; - summary.num_iterations < options_.max_num_iterations; + summary.num_iterations <= options_.max_num_iterations; ++summary.num_iterations) { // Apply preconditioner if (per_solve_options.preconditioner != NULL) { diff --git a/internal/ceres/graph.h b/internal/ceres/graph.h index 38fdae30f..f639d1532 100644 --- a/internal/ceres/graph.h +++ b/internal/ceres/graph.h @@ -44,7 +44,7 @@ namespace ceres { namespace internal { // A unweighted undirected graph templated over the vertex ids. Vertex -// should be hashable and comparable. +// should be hashable. template class Graph { public: diff --git a/internal/ceres/graph_algorithms.h b/internal/ceres/graph_algorithms.h index 46a37c5fe..fb75e2f45 100644 --- a/internal/ceres/graph_algorithms.h +++ b/internal/ceres/graph_algorithms.h @@ -172,8 +172,6 @@ int IndependentSetOrdering(const Graph& graph, template int StableIndependentSetOrdering(const Graph& graph, vector* ordering) { - EventLogger event_logger("StableIndependentSetOrdering"); - CHECK_NOTNULL(ordering); const HashSet& vertices = graph.vertices(); const int num_vertices = vertices.size(); @@ -188,7 +186,6 @@ int StableIndependentSetOrdering(const Graph& graph, stable_sort(vertex_queue.begin(), vertex_queue.end(), VertexDegreeLessThan(graph)); - event_logger.AddEvent("StableSort"); // Mark all vertices white. HashMap vertex_color; @@ -197,7 +194,6 @@ int StableIndependentSetOrdering(const Graph& graph, ++it) { vertex_color[*it] = kWhite; } - event_logger.AddEvent("MarkWhite"); ordering->clear(); ordering->reserve(num_vertices); @@ -218,7 +214,6 @@ int StableIndependentSetOrdering(const Graph& graph, vertex_color[*it] = kGrey; } } - event_logger.AddEvent("IndependentVertices"); int independent_set_size = ordering->size(); @@ -234,7 +229,6 @@ int StableIndependentSetOrdering(const Graph& graph, ordering->push_back(vertex); } } - event_logger.AddEvent("DependentVertices"); CHECK_EQ(ordering->size(), num_vertices); return independent_set_size; diff --git a/internal/ceres/single_linkage_clustering_test.cc b/internal/ceres/single_linkage_clustering_test.cc index 1d4efd29e..95692eacb 100644 --- a/internal/ceres/single_linkage_clustering_test.cc +++ b/internal/ceres/single_linkage_clustering_test.cc @@ -61,7 +61,8 @@ TEST(SingleLinkageClustering, GraphHasTwoComponents) { ComputeSingleLinkageClustering(options, graph, &membership); EXPECT_EQ(membership.size(), kNumVertices); - EXPECT_EQ(membership[1], membership[0]); EXPECT_EQ(membership[2], membership[0]); + EXPECT_EQ(membership[1], membership[0]); + EXPECT_EQ(membership[2], membership[0]); EXPECT_EQ(membership[3], membership[0]); EXPECT_NE(membership[4], membership[0]); EXPECT_NE(membership[5], membership[0]); diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc index e5ad90e38..f62ab5d78 100644 --- a/internal/ceres/solver.cc +++ b/internal/ceres/solver.cc @@ -206,15 +206,15 @@ bool TrustRegionOptionsAreValid(const Solver::Options& options, string* error) { if (options.sparse_linear_algebra_library_type == EIGEN_SPARSE) { if (options.linear_solver_type == SPARSE_NORMAL_CHOLESKY) { *error = "Can't use SPARSE_NORMAL_CHOLESKY with EIGEN_SPARSE because " - "Eigen's sparse linear algebra was not enabled when Ceres " - " was built."; + "Eigen's sparse linear algebra was not enabled when Ceres was " + "built."; return false; } if (options.linear_solver_type == SPARSE_SCHUR) { *error = "Can't use SPARSE_SCHUR with EIGEN_SPARSE because " - "Eigen's sparse linear algebra was not enabled when Ceres " - " was built."; + "Eigen's sparse linear algebra was not enabled when Ceres was " + "built."; return false; } } diff --git a/internal/ceres/visibility.cc b/internal/ceres/visibility.cc index e46421cbf..da8beedc6 100644 --- a/internal/ceres/visibility.cc +++ b/internal/ceres/visibility.cc @@ -76,7 +76,8 @@ void ComputeVisibility(const CompressedRowBlockStructure& block_structure, } } -WeightedGraph* CreateSchurComplementGraph(const vector >& visibility) { +WeightedGraph* CreateSchurComplementGraph( + const vector >& visibility) { const time_t start_time = time(NULL); // Compute the number of e_blocks/point blocks. Since the visibility // set for each e_block/camera contains the set of e_blocks/points @@ -122,7 +123,7 @@ WeightedGraph* CreateSchurComplementGraph(const vector >& visibili } } - WeightedGraph* graph = new WeightedGraph(); + WeightedGraph* graph = new WeightedGraph; // Add vertices and initialize the pairs for self edges so that self // edges are guaranteed. This is needed for the Canonical views diff --git a/internal/ceres/visibility.h b/internal/ceres/visibility.h index 62d4f0faf..322efe9be 100644 --- a/internal/ceres/visibility.h +++ b/internal/ceres/visibility.h @@ -74,7 +74,8 @@ void ComputeVisibility(const CompressedRowBlockStructure& block_structure, // // Caller acquires ownership of the returned WeightedGraph pointer // (heap-allocated). -WeightedGraph* CreateSchurComplementGraph(const vector >& visibility); +WeightedGraph* CreateSchurComplementGraph( + const vector >& visibility); } // namespace internal } // namespace ceres diff --git a/internal/ceres/visibility_based_preconditioner.h b/internal/ceres/visibility_based_preconditioner.h index 7e0b51b1f..2f6922dce 100644 --- a/internal/ceres/visibility_based_preconditioner.h +++ b/internal/ceres/visibility_based_preconditioner.h @@ -156,7 +156,8 @@ class VisibilityBasedPreconditioner : public BlockSparseMatrixPreconditioner { vector* membership_vector) const; void ComputeClusterVisibility(const vector >& visibility, vector >* cluster_visibility) const; - WeightedGraph* CreateClusterGraph(const vector >& visibility) const; + WeightedGraph* CreateClusterGraph( + const vector >& visibility) const; void ForestToClusterPairs(const WeightedGraph& forest, HashSet >* cluster_pairs) const; void ComputeBlockPairsInPreconditioner(const CompressedRowBlockStructure& bs);