Lint cleanup from William Rucklidge. Change-Id: I745810f5496a1b93263b20ff140f8883da61995e
diff --git a/docs/source/solving.rst b/docs/source/solving.rst index 03c070a..d9b7e8f 100644 --- a/docs/source/solving.rst +++ b/docs/source/solving.rst
@@ -316,9 +316,9 @@ ------------------- Note that the basic trust-region algorithm described in -:ref:`section-trust-region-methods` is a descent algorithm in that -they only accepts a point if it strictly reduces the value of the -objective function. +:ref:`section-trust-region-methods` is a descent algorithm in that it +only accepts a point if it strictly reduces the value of the objective +function. Relaxing this requirement allows the algorithm to be more efficient in the long term at the cost of some local increase in the value of the
diff --git a/internal/ceres/covariance_impl.cc b/internal/ceres/covariance_impl.cc index 91f0393..faa0ce5 100644 --- a/internal/ceres/covariance_impl.cc +++ b/internal/ceres/covariance_impl.cc
@@ -470,7 +470,7 @@ LOG(ERROR) << "Cholesky factorization of J'J is not reliable. " << "Reciprocal condition number: " << reciprocal_condition_number << " " - << "min_reciprocal_condition_number : " + << "min_reciprocal_condition_number: " << options_.min_reciprocal_condition_number; ss.Free(factor); return false; @@ -822,7 +822,7 @@ LOG(ERROR) << "Cholesky factorization of J'J is not reliable. " << "Reciprocal condition number: " << singular_value_ratio * singular_value_ratio << " " - << "min_reciprocal_condition_number : " + << "min_reciprocal_condition_number: " << options_.min_reciprocal_condition_number; return false; }
diff --git a/internal/ceres/lapack.cc b/internal/ceres/lapack.cc index c4f9302..90973fa 100644 --- a/internal/ceres/lapack.cc +++ b/internal/ceres/lapack.cc
@@ -138,7 +138,7 @@ LOG(FATAL) << "Congratulations, you found a bug in Ceres." << "Please report it." << "LAPACK::dgels fatal error." - << "Argument: " << info << " is invalid."; + << "Argument: " << -info << " is invalid."; } return static_cast<int>(work); #endif
diff --git a/internal/ceres/solver_impl_test.cc b/internal/ceres/solver_impl_test.cc index 30eeea2..f0f36ad 100644 --- a/internal/ceres/solver_impl_test.cc +++ b/internal/ceres/solver_impl_test.cc
@@ -99,11 +99,12 @@ inner_iteration_ordering.AddElementToGroup(&z, 0); Program program(*problem.mutable_program()); - EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram(&program, - &linear_solver_ordering, - &inner_iteration_ordering, - NULL, - &error)); + EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram( + &program, + &linear_solver_ordering, + &inner_iteration_ordering, + NULL, + &error)); EXPECT_EQ(program.NumParameterBlocks(), 3); EXPECT_EQ(program.NumResidualBlocks(), 3); EXPECT_EQ(linear_solver_ordering.NumElements(), 3); @@ -127,11 +128,12 @@ Program program(problem.program()); string error; - EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram(&program, - &linear_solver_ordering, - &inner_iteration_ordering, - NULL, - &error)); + EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram( + &program, + &linear_solver_ordering, + &inner_iteration_ordering, + NULL, + &error)); EXPECT_EQ(program.NumParameterBlocks(), 0); EXPECT_EQ(program.NumResidualBlocks(), 0); EXPECT_EQ(linear_solver_ordering.NumElements(), 0); @@ -160,11 +162,12 @@ Program program(problem.program()); string error; - EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram(&program, - &linear_solver_ordering, - &inner_iteration_ordering, - NULL, - &error)); + EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram( + &program, + &linear_solver_ordering, + &inner_iteration_ordering, + NULL, + &error)); EXPECT_EQ(program.NumParameterBlocks(), 0); EXPECT_EQ(program.NumResidualBlocks(), 0); EXPECT_EQ(linear_solver_ordering.NumElements(), 0); @@ -198,11 +201,12 @@ Program program(problem.program()); string error; - EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram(&program, - &linear_solver_ordering, - &inner_iteration_ordering, - NULL, - &error)); + EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram( + &program, + &linear_solver_ordering, + &inner_iteration_ordering, + NULL, + &error)); EXPECT_EQ(program.NumParameterBlocks(), 1); EXPECT_EQ(program.NumResidualBlocks(), 1); EXPECT_EQ(linear_solver_ordering.NumElements(), 1); @@ -235,11 +239,12 @@ Program program(problem.program()); string error; - EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram(&program, - &linear_solver_ordering, - &inner_iteration_ordering, - NULL, - &error)); + EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram( + &program, + &linear_solver_ordering, + &inner_iteration_ordering, + NULL, + &error)); EXPECT_EQ(program.NumParameterBlocks(), 2); EXPECT_EQ(program.NumResidualBlocks(), 2); EXPECT_EQ(linear_solver_ordering.NumElements(), 2); @@ -283,11 +288,12 @@ scratch.get()); string error; - EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram(&program, - &linear_solver_ordering, - NULL, - &fixed_cost, - &error)); + EXPECT_TRUE(SolverImpl::RemoveFixedBlocksFromProgram( + &program, + &linear_solver_ordering, + NULL, + &fixed_cost, + &error)); EXPECT_EQ(program.NumParameterBlocks(), 2); EXPECT_EQ(program.NumResidualBlocks(), 2); EXPECT_EQ(linear_solver_ordering.NumElements(), 2);
diff --git a/internal/ceres/suitesparse.cc b/internal/ceres/suitesparse.cc index 06cc0a8..8a52631 100644 --- a/internal/ceres/suitesparse.cc +++ b/internal/ceres/suitesparse.cc
@@ -122,7 +122,7 @@ } cholmod_factor* SuiteSparse::AnalyzeCholesky(cholmod_sparse* A, - string* status) { + string* message) { // Cholmod can try multiple re-ordering strategies to find a fill // reducing ordering. Here we just tell it use AMD with automatic // matrix dependence choice of supernodal versus simplicial @@ -137,7 +137,7 @@ } if (cc_.status != CHOLMOD_OK) { - *status = StringPrintf("cholmod_analyze failed. error code: %d", + *message = StringPrintf("cholmod_analyze failed. error code: %d", cc_.status); return NULL; } @@ -149,18 +149,18 @@ cholmod_sparse* A, const vector<int>& row_blocks, const vector<int>& col_blocks, - string* status) { + string* message) { vector<int> ordering; if (!BlockAMDOrdering(A, row_blocks, col_blocks, &ordering)) { return NULL; } - return AnalyzeCholeskyWithUserOrdering(A, ordering, status); + return AnalyzeCholeskyWithUserOrdering(A, ordering, message); } cholmod_factor* SuiteSparse::AnalyzeCholeskyWithUserOrdering( cholmod_sparse* A, const vector<int>& ordering, - string* status) { + string* message) { CHECK_EQ(ordering.size(), A->nrow); cc_.nmethods = 1; @@ -172,7 +172,7 @@ cholmod_print_common(const_cast<char*>("Symbolic Analysis"), &cc_); } if (cc_.status != CHOLMOD_OK) { - *status = StringPrintf("cholmod_analyze failed. error code: %d", + *message = StringPrintf("cholmod_analyze failed. error code: %d", cc_.status); return NULL; } @@ -182,7 +182,7 @@ cholmod_factor* SuiteSparse::AnalyzeCholeskyWithNaturalOrdering( cholmod_sparse* A, - string* status) { + string* message) { cc_.nmethods = 1; cc_.method[0].ordering = CHOLMOD_NATURAL; cc_.postorder = 0; @@ -192,7 +192,7 @@ cholmod_print_common(const_cast<char*>("Symbolic Analysis"), &cc_); } if (cc_.status != CHOLMOD_OK) { - *status = StringPrintf("cholmod_analyze failed. error code: %d", + *message = StringPrintf("cholmod_analyze failed. error code: %d", cc_.status); return NULL; } @@ -244,7 +244,7 @@ LinearSolverTerminationType SuiteSparse::Cholesky(cholmod_sparse* A, cholmod_factor* L, - string* status) { + string* message) { CHECK_NOTNULL(A); CHECK_NOTNULL(L); @@ -268,35 +268,35 @@ // (e.g. out of memory). switch (cc_.status) { case CHOLMOD_NOT_INSTALLED: - *status = "CHOLMOD failure: Method not installed."; + *message = "CHOLMOD failure: Method not installed."; return LINEAR_SOLVER_FATAL_ERROR; case CHOLMOD_OUT_OF_MEMORY: - *status = "CHOLMOD failure: Out of memory."; + *message = "CHOLMOD failure: Out of memory."; return LINEAR_SOLVER_FATAL_ERROR; case CHOLMOD_TOO_LARGE: - *status = "CHOLMOD failure: Integer overflow occured."; + *message = "CHOLMOD failure: Integer overflow occured."; return LINEAR_SOLVER_FATAL_ERROR; case CHOLMOD_INVALID: - *status = "CHOLMOD failure: Invalid input."; + *message = "CHOLMOD failure: Invalid input."; return LINEAR_SOLVER_FATAL_ERROR; case CHOLMOD_NOT_POSDEF: - *status = "CHOLMOD warning: Matrix not positive definite."; + *message = "CHOLMOD warning: Matrix not positive definite."; return LINEAR_SOLVER_FAILURE; case CHOLMOD_DSMALL: - *status = "CHOLMOD warning: D for LDL' or diag(L) or " + *message = "CHOLMOD warning: D for LDL' or diag(L) or " "LL' has tiny absolute value."; return LINEAR_SOLVER_FAILURE; case CHOLMOD_OK: - if (cholmod_status != 0) { + if (cholmod_message != 0) { return LINEAR_SOLVER_SUCCESS; } - *status = "CHOLMOD failure: cholmod_factorize returned false " + *message = "CHOLMOD failure: cholmod_factorize returned false " "but cholmod_common::status is CHOLMOD_OK." "Please report this to ceres-solver@googlegroups.com."; return LINEAR_SOLVER_FATAL_ERROR; default: - *status = + *message = StringPrintf("Unknown cholmod return code: %d. " "Please report this to ceres-solver@googlegroups.com.", cc_.status); @@ -308,9 +308,9 @@ cholmod_dense* SuiteSparse::Solve(cholmod_factor* L, cholmod_dense* b, - string* status) { + string* message) { if (cc_.status != CHOLMOD_OK) { - *status = "cholmod_solve failed. CHOLMOD status is not CHOLMOD_OK"; + *message = "cholmod_solve failed. CHOLMOD status is not CHOLMOD_OK"; return NULL; }
diff --git a/internal/ceres/suitesparse.h b/internal/ceres/suitesparse.h index 0604654..85cceb1 100644 --- a/internal/ceres/suitesparse.h +++ b/internal/ceres/suitesparse.h
@@ -1,4 +1,4 @@ -// Ceres Solver - A fast non-linear least squares minimizer +s// Ceres Solver - A fast non-linear least squares minimizer // Copyright 2010, 2011, 2012 Google Inc. All rights reserved. // http://code.google.com/p/ceres-solver/ // @@ -139,15 +139,15 @@ // A is not modified, only the pattern of non-zeros of A is used, // the actual numerical values in A are of no consequence. // - // status contains an explanation of the failures if any. + // message contains an explanation of the failures if any. // // Caller owns the result. - cholmod_factor* AnalyzeCholesky(cholmod_sparse* A, string* status); + cholmod_factor* AnalyzeCholesky(cholmod_sparse* A, string* message); cholmod_factor* BlockAnalyzeCholesky(cholmod_sparse* A, const vector<int>& row_blocks, const vector<int>& col_blocks, - string* status); + string* message); // If A is symmetric, then compute the symbolic Cholesky // factorization of A(ordering, ordering). If A is unsymmetric, then @@ -157,38 +157,38 @@ // A is not modified, only the pattern of non-zeros of A is used, // the actual numerical values in A are of no consequence. // - // status contains an explanation of the failures if any. + // message contains an explanation of the failures if any. // // Caller owns the result. cholmod_factor* AnalyzeCholeskyWithUserOrdering(cholmod_sparse* A, const vector<int>& ordering, - string* status); + string* message); // Perform a symbolic factorization of A without re-ordering A. No // postordering of the elimination tree is performed. This ensures // that the symbolic factor does not introduce an extra permutation // on the matrix. See the documentation for CHOLMOD for more details. // - // status contains an explanation of the failures if any. + // message contains an explanation of the failures if any. cholmod_factor* AnalyzeCholeskyWithNaturalOrdering(cholmod_sparse* A, - string* status); + string* message); // Use the symbolic factorization in L, to find the numerical // factorization for the matrix A or AA^T. Return true if // successful, false otherwise. L contains the numeric factorization // on return. // - // status contains an explanation of the failures if any. + // message contains an explanation of the failures if any. LinearSolverTerminationType Cholesky(cholmod_sparse* A, cholmod_factor* L, - string* status); + string* message); // Given a Cholesky factorization of a matrix A = LL^T, solve the // linear system Ax = b, and return the result. If the Solve fails // NULL is returned. Caller owns the result. // - // status contains an explanation of the failures if any. - cholmod_dense* Solve(cholmod_factor* L, cholmod_dense* b, string* solve); + // message contains an explanation of the failures if any. + cholmod_dense* Solve(cholmod_factor* L, cholmod_dense* b, string* message); // By virtue of the modeling layer in Ceres being block oriented, // all the matrices used by Ceres are also block oriented. When