ClangFormat cleanup via scripts/all_format.sh Change-Id: Ideafec543a9d090a767bae58123b7512c9e9ae4a
diff --git a/examples/helloworld_analytic_diff.cc b/examples/helloworld_analytic_diff.cc index 273a102..7cf6111 100644 --- a/examples/helloworld_analytic_diff.cc +++ b/examples/helloworld_analytic_diff.cc
@@ -49,7 +49,6 @@ : public SizedCostFunction<1 /* number of residuals */, 1 /* size of first parameter */> { public: - bool Evaluate(double const* const* parameters, double* residuals, double** jacobians) const override {
diff --git a/examples/rosenbrock_analytic_diff.cc b/examples/rosenbrock_analytic_diff.cc index 96db348..7b02d7a 100644 --- a/examples/rosenbrock_analytic_diff.cc +++ b/examples/rosenbrock_analytic_diff.cc
@@ -34,7 +34,6 @@ // f(x,y) = (1-x)^2 + 100(y - x^2)^2; class Rosenbrock final : public ceres::FirstOrderFunction { public: - bool Evaluate(const double* parameters, double* cost, double* gradient) const override {
diff --git a/include/ceres/covariance.h b/include/ceres/covariance.h index b787187..60bcc80 100644 --- a/include/ceres/covariance.h +++ b/include/ceres/covariance.h
@@ -35,8 +35,8 @@ #include <utility> #include <vector> -#include "ceres/internal/disable_warnings.h" #include "ceres/internal/config.h" +#include "ceres/internal/disable_warnings.h" #include "ceres/internal/export.h" #include "ceres/types.h"
diff --git a/include/ceres/dynamic_cost_function.h b/include/ceres/dynamic_cost_function.h index d635b88..c84a366 100644 --- a/include/ceres/dynamic_cost_function.h +++ b/include/ceres/dynamic_cost_function.h
@@ -41,7 +41,6 @@ // parameter blocks and set the number of residuals at run time. class CERES_EXPORT DynamicCostFunction : public CostFunction { public: - virtual void AddParameterBlock(int size) { mutable_parameter_block_sizes()->push_back(size); }
diff --git a/include/ceres/sized_cost_function.h b/include/ceres/sized_cost_function.h index ad99002..d76b5c2 100644 --- a/include/ceres/sized_cost_function.h +++ b/include/ceres/sized_cost_function.h
@@ -61,7 +61,6 @@ *mutable_parameter_block_sizes() = std::vector<int32_t>{Ns...}; } - // Subclasses must implement Evaluate(). };
diff --git a/include/ceres/sphere_manifold.h b/include/ceres/sphere_manifold.h index c2ad5d3..5d71cbb 100644 --- a/include/ceres/sphere_manifold.h +++ b/include/ceres/sphere_manifold.h
@@ -228,4 +228,4 @@ #include "ceres/internal/reenable_warnings.h" // clang-format on -#endif // CERES_PUBLIC_SPHERE_MANIFOLD_H_ +#endif // CERES_PUBLIC_SPHERE_MANIFOLD_H_
diff --git a/include/ceres/version.h b/include/ceres/version.h index 557847e..e0d6197 100644 --- a/include/ceres/version.h +++ b/include/ceres/version.h
@@ -41,9 +41,9 @@ #define CERES_TO_STRING(x) CERES_TO_STRING_HELPER(x) // The Ceres version as a string; for example "1.9.0". -#define CERES_VERSION_STRING \ - CERES_TO_STRING(CERES_VERSION_MAJOR) "." \ - CERES_TO_STRING(CERES_VERSION_MINOR) "." \ - CERES_TO_STRING(CERES_VERSION_REVISION) +#define CERES_VERSION_STRING \ + CERES_TO_STRING(CERES_VERSION_MAJOR) \ + "." CERES_TO_STRING(CERES_VERSION_MINOR) "." CERES_TO_STRING( \ + CERES_VERSION_REVISION) #endif // CERES_PUBLIC_VERSION_H_
diff --git a/internal/ceres/autodiff_benchmarks/brdf_cost_function.h b/internal/ceres/autodiff_benchmarks/brdf_cost_function.h index 767b423..87842c0 100644 --- a/internal/ceres/autodiff_benchmarks/brdf_cost_function.h +++ b/internal/ceres/autodiff_benchmarks/brdf_cost_function.h
@@ -45,7 +45,6 @@ // https://github.com/wdas/brdf/blob/master/src/brdfs/disney.brdf struct Brdf { public: - template <typename T> inline bool operator()(const T* const material, const T* const c_ptr,
diff --git a/internal/ceres/canonical_views_clustering.cc b/internal/ceres/canonical_views_clustering.cc index c7565c1..01b8ad3 100644 --- a/internal/ceres/canonical_views_clustering.cc +++ b/internal/ceres/canonical_views_clustering.cc
@@ -49,7 +49,6 @@ class CERES_NO_EXPORT CanonicalViewsClustering { public: - // Compute the canonical views clustering of the vertices of the // graph. centers will contain the vertices that are the identified // as the canonical views/cluster centers, and membership is a map
diff --git a/internal/ceres/context_impl.cc b/internal/ceres/context_impl.cc index 43a7c17..a4b3c84 100644 --- a/internal/ceres/context_impl.cc +++ b/internal/ceres/context_impl.cc
@@ -35,8 +35,8 @@ #include "ceres/internal/config.h" #ifndef CERES_NO_CUDA -#include "cuda_runtime.h" #include "cublas_v2.h" +#include "cuda_runtime.h" #include "cusolverDn.h" #endif // CERES_NO_CUDA @@ -73,7 +73,7 @@ return false; } if (cusolverDnSetStream(cusolver_handle_, stream_) != - CUSOLVER_STATUS_SUCCESS || + CUSOLVER_STATUS_SUCCESS || cublasSetStream(cublas_handle_, stream_) != CUBLAS_STATUS_SUCCESS) { *message = "cuSolverDN::cusolverDnSetStream or cuBLAS::cublasSetStream failed.";
diff --git a/internal/ceres/context_impl.h b/internal/ceres/context_impl.h index ed6bedc..8e9a03f 100644 --- a/internal/ceres/context_impl.h +++ b/internal/ceres/context_impl.h
@@ -43,8 +43,8 @@ #include "ceres/internal/export.h" #ifndef CERES_NO_CUDA -#include "cuda_runtime.h" #include "cublas_v2.h" +#include "cuda_runtime.h" #include "cusolverDn.h" #endif // CERES_NO_CUDA @@ -62,7 +62,6 @@ ContextImpl(const ContextImpl&) = delete; void operator=(const ContextImpl&) = delete; - // When compiled with C++ threading support, resize the thread pool to have // at min(num_thread, num_hardware_threads) where num_hardware_threads is // defined by the hardware. Otherwise this call is a no-op.
diff --git a/internal/ceres/covariance_test.cc b/internal/ceres/covariance_test.cc index 33074c0..84afced 100644 --- a/internal/ceres/covariance_test.cc +++ b/internal/ceres/covariance_test.cc
@@ -380,7 +380,6 @@ // x_plus_delta = delta * x; class PolynomialParameterization : public LocalParameterization { public: - bool Plus(const double* x, const double* delta, double* x_plus_delta) const final { @@ -402,7 +401,6 @@ // x_plus_delta = delta * x; class PolynomialManifold : public Manifold { public: - bool Plus(const double* x, const double* delta, double* x_plus_delta) const final {
diff --git a/internal/ceres/cuda_buffer.h b/internal/ceres/cuda_buffer.h index 61f9752..a1cf784 100644 --- a/internal/ceres/cuda_buffer.h +++ b/internal/ceres/cuda_buffer.h
@@ -76,11 +76,8 @@ // provided. void CopyToGpuAsync(const T* data, const size_t size, cudaStream_t stream) { Reserve(size); - CHECK_EQ(cudaMemcpyAsync(data_, - data, - size * sizeof(T), - cudaMemcpyHostToDevice, - stream), + CHECK_EQ(cudaMemcpyAsync( + data_, data, size * sizeof(T), cudaMemcpyHostToDevice, stream), cudaSuccess); }
diff --git a/internal/ceres/dense_cholesky.cc b/internal/ceres/dense_cholesky.cc index 2e7b781..0e0bba7 100644 --- a/internal/ceres/dense_cholesky.cc +++ b/internal/ceres/dense_cholesky.cc
@@ -207,8 +207,9 @@ return true; } -LinearSolverTerminationType CUDADenseCholesky::Factorize( - int num_cols, double* lhs, std::string* message) { +LinearSolverTerminationType CUDADenseCholesky::Factorize(int num_cols, + double* lhs, + std::string* message) { factorize_result_ = LinearSolverTerminationType::LINEAR_SOLVER_FATAL_ERROR; lhs_.Reserve(num_cols * num_cols); num_cols_ = num_cols; @@ -264,8 +265,9 @@ return LinearSolverTerminationType::LINEAR_SOLVER_SUCCESS; } -LinearSolverTerminationType CUDADenseCholesky::Solve( - const double* rhs, double* solution, std::string* message) { +LinearSolverTerminationType CUDADenseCholesky::Solve(const double* rhs, + double* solution, + std::string* message) { if (factorize_result_ != LinearSolverTerminationType::LINEAR_SOLVER_SUCCESS) { *message = "Factorize did not complete succesfully previously."; return factorize_result_;
diff --git a/internal/ceres/dense_qr.cc b/internal/ceres/dense_qr.cc index ad9b64e..4b9c8a4 100644 --- a/internal/ceres/dense_qr.cc +++ b/internal/ceres/dense_qr.cc
@@ -35,8 +35,8 @@ #include <string> #ifndef CERES_NO_CUDA #include "ceres/context_impl.h" -#include "cusolverDn.h" #include "cublas_v2.h" +#include "cusolverDn.h" #endif // CERES_NO_CUDA #ifndef CERES_NO_LAPACK @@ -323,8 +323,10 @@ return true; } -LinearSolverTerminationType CUDADenseQR::Factorize( - int num_rows, int num_cols, double* lhs, std::string* message) { +LinearSolverTerminationType CUDADenseQR::Factorize(int num_rows, + int num_cols, + double* lhs, + std::string* message) { factorize_result_ = LinearSolverTerminationType::LINEAR_SOLVER_FATAL_ERROR; lhs_.Reserve(num_rows * num_cols); tau_.Reserve(std::min(num_rows, num_cols)); @@ -377,8 +379,9 @@ return LinearSolverTerminationType::LINEAR_SOLVER_SUCCESS; } -LinearSolverTerminationType CUDADenseQR::Solve( - const double* rhs, double* solution, std::string* message) { +LinearSolverTerminationType CUDADenseQR::Solve(const double* rhs, + double* solution, + std::string* message) { if (factorize_result_ != LinearSolverTerminationType::LINEAR_SOLVER_SUCCESS) { *message = "Factorize did not complete succesfully previously."; return factorize_result_; @@ -459,8 +462,7 @@ // The user called the wrong factory method. return nullptr; } - auto cuda_dense_qr = - std::unique_ptr<CUDADenseQR>(new CUDADenseQR()); + auto cuda_dense_qr = std::unique_ptr<CUDADenseQR>(new CUDADenseQR()); std::string cuda_error; if (cuda_dense_qr->Init(options.context, &cuda_error)) { return cuda_dense_qr; @@ -471,10 +473,9 @@ return nullptr; } -CUDADenseQR::CUDADenseQR() = default; +CUDADenseQR::CUDADenseQR() = default; #endif // CERES_NO_CUDA - } // namespace internal } // namespace ceres
diff --git a/internal/ceres/dense_qr_test.cc b/internal/ceres/dense_qr_test.cc index 402a7e2..199e033 100644 --- a/internal/ceres/dense_qr_test.cc +++ b/internal/ceres/dense_qr_test.cc
@@ -107,15 +107,14 @@ // NOTE: preprocessor directives in a macro are not standard conforming decltype(auto) MakeValues() { - return ::testing::Values( - EIGEN + return ::testing::Values(EIGEN #ifndef CERES_NO_LAPACK - , - LAPACK + , + LAPACK #endif #ifndef CERES_NO_CUDA - , - CUDA + , + CUDA #endif ); }
diff --git a/internal/ceres/gradient_problem_solver_test.cc b/internal/ceres/gradient_problem_solver_test.cc index 407fb17..ffd827e 100644 --- a/internal/ceres/gradient_problem_solver_test.cc +++ b/internal/ceres/gradient_problem_solver_test.cc
@@ -39,7 +39,6 @@ // Rosenbrock function; see http://en.wikipedia.org/wiki/Rosenbrock_function . class Rosenbrock : public ceres::FirstOrderFunction { public: - bool Evaluate(const double* parameters, double* cost, double* gradient) const final {
diff --git a/internal/ceres/graph.h b/internal/ceres/graph.h index 313474f..6a6f8f0 100644 --- a/internal/ceres/graph.h +++ b/internal/ceres/graph.h
@@ -50,7 +50,6 @@ template <typename Vertex> class CERES_NO_EXPORT Graph { public: - // Add a vertex. void AddVertex(const Vertex& vertex) { if (vertices_.insert(vertex).second) { @@ -106,7 +105,6 @@ template <typename Vertex> class WeightedGraph { public: - // Add a weighted vertex. If the vertex already exists in the graph, // its weight is set to the new weight. void AddVertex(const Vertex& vertex, double weight) {
diff --git a/internal/ceres/is_close.h b/internal/ceres/is_close.h index 498e75e..a1e4e2f 100644 --- a/internal/ceres/is_close.h +++ b/internal/ceres/is_close.h
@@ -40,9 +40,9 @@ namespace internal { // Returns true if x and y have a relative (unsigned) difference less than // relative_precision and false otherwise. Stores the relative and absolute -// difference in relative/absolute_error if non-nullptr. If one of the two values -// is exactly zero, the absolute difference will be compared, and relative_error -// will be set to the absolute difference. +// difference in relative/absolute_error if non-nullptr. If one of the two +// values is exactly zero, the absolute difference will be compared, and +// relative_error will be set to the absolute difference. CERES_NO_EXPORT bool IsClose(double x, double y, double relative_precision,
diff --git a/internal/ceres/levenberg_marquardt_strategy_test.cc b/internal/ceres/levenberg_marquardt_strategy_test.cc index 86d35a2..d79323f 100644 --- a/internal/ceres/levenberg_marquardt_strategy_test.cc +++ b/internal/ceres/levenberg_marquardt_strategy_test.cc
@@ -58,7 +58,6 @@ RegularizationCheckingLinearSolver(const int num_cols, const double* diagonal) : num_cols_(num_cols), diagonal_(diagonal) {} - private: LinearSolver::Summary SolveImpl( DenseSparseMatrix* A,
diff --git a/internal/ceres/parameter_block_test.cc b/internal/ceres/parameter_block_test.cc index 53786da..6fcbf5e 100644 --- a/internal/ceres/parameter_block_test.cc +++ b/internal/ceres/parameter_block_test.cc
@@ -111,7 +111,6 @@ struct TestManifold : public Manifold { public: - bool Plus(const double* x, const double* delta, double* x_plus_delta) const final {
diff --git a/internal/ceres/polynomial.h b/internal/ceres/polynomial.h index 236533f..3ca753c 100644 --- a/internal/ceres/polynomial.h +++ b/internal/ceres/polynomial.h
@@ -67,7 +67,8 @@ // that the eigenvalues of the companion matrix could not be computed. // On failure, a more detailed message will be written to LOG(ERROR). // If real is not nullptr, the real parts of the roots will be returned in it. -// Likewise, if imaginary is not nullptr, imaginary parts will be returned in it. +// Likewise, if imaginary is not nullptr, imaginary parts will be returned in +// it. CERES_NO_EXPORT bool FindPolynomialRoots(const Vector& polynomial, Vector* real, Vector* imaginary);
diff --git a/internal/ceres/program.cc b/internal/ceres/program.cc index 66dc90b..1cb9ebc 100644 --- a/internal/ceres/program.cc +++ b/internal/ceres/program.cc
@@ -54,7 +54,6 @@ namespace ceres { namespace internal { - const std::vector<ParameterBlock*>& Program::parameter_blocks() const { return parameter_blocks_; }
diff --git a/internal/ceres/program_test.cc b/internal/ceres/program_test.cc index 8f1c422..8dc1377 100644 --- a/internal/ceres/program_test.cc +++ b/internal/ceres/program_test.cc
@@ -331,7 +331,6 @@ } } - bool Evaluate(double const* const* parameters, double* residuals, double** jacobians) const final {
diff --git a/internal/ceres/residual_block.h b/internal/ceres/residual_block.h index 2de363b..978b946 100644 --- a/internal/ceres/residual_block.h +++ b/internal/ceres/residual_block.h
@@ -80,8 +80,8 @@ // components in *residuals, and the jacobians between the parameters and // residuals in jacobians[i], in row-major order. If residuals is nullptr, the // residuals are not computed. If jacobians is nullptr, no jacobians are - // computed. If jacobians[i] is nullptr, then the jacobian for that parameter is - // not computed. + // computed. If jacobians[i] is nullptr, then the jacobian for that parameter + // is not computed. // // cost must not be null. //