ClangFormat cleanup via scripts/all_format.sh

Change-Id: Ideafec543a9d090a767bae58123b7512c9e9ae4a
This commit is contained in:
Sameer Agarwal
2022-03-12 16:25:45 -08:00
parent 4705159858
commit ee35ef66f6
25 changed files with 39 additions and 55 deletions
-1
View File
@@ -49,7 +49,6 @@ class QuadraticCostFunction
: public SizedCostFunction<1 /* number of residuals */,
1 /* size of first parameter */> {
public:
bool Evaluate(double const* const* parameters,
double* residuals,
double** jacobians) const override {
-1
View File
@@ -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 {
+1 -1
View File
@@ -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"
-1
View File
@@ -41,7 +41,6 @@ namespace ceres {
// 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);
}
-1
View File
@@ -61,7 +61,6 @@ class SizedCostFunction : public CostFunction {
*mutable_parameter_block_sizes() = std::vector<int32_t>{Ns...};
}
// Subclasses must implement Evaluate().
};
+1 -1
View File
@@ -228,4 +228,4 @@ bool SphereManifold<AmbientSpaceDimension>::MinusJacobian(
#include "ceres/internal/reenable_warnings.h"
// clang-format on
#endif // CERES_PUBLIC_SPHERE_MANIFOLD_H_
#endif // CERES_PUBLIC_SPHERE_MANIFOLD_H_
+4 -4
View File
@@ -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_
@@ -45,7 +45,6 @@ namespace ceres {
// 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,
@@ -49,7 +49,6 @@ using IntSet = std::unordered_set<int>;
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
+2 -2
View File
@@ -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 @@ bool ContextImpl::InitCUDA(std::string* message) {
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.";
+1 -2
View File
@@ -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 @@ class CERES_NO_EXPORT ContextImpl final : public Context {
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.
-2
View File
@@ -380,7 +380,6 @@ TEST(CovarianceImpl, ComputeCovarianceSparsityWithFreeParameterBlock) {
// 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 @@ class PolynomialParameterization : public LocalParameterization {
// x_plus_delta = delta * x;
class PolynomialManifold : public Manifold {
public:
bool Plus(const double* x,
const double* delta,
double* x_plus_delta) const final {
+2 -5
View File
@@ -76,11 +76,8 @@ class CudaBuffer {
// 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);
}
+6 -4
View File
@@ -207,8 +207,9 @@ bool CUDADenseCholesky::Init(ContextImpl* context, std::string* message) {
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 @@ LinearSolverTerminationType CUDADenseCholesky::Factorize(
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_;
+10 -9
View File
@@ -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 @@ bool CUDADenseQR::Init(ContextImpl* context, std::string* message) {
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 @@ LinearSolverTerminationType CUDADenseQR::Factorize(
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 @@ std::unique_ptr<CUDADenseQR> CUDADenseQR::Create(
// 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 @@ std::unique_ptr<CUDADenseQR> CUDADenseQR::Create(
return nullptr;
}
CUDADenseQR::CUDADenseQR() = default;
CUDADenseQR::CUDADenseQR() = default;
#endif // CERES_NO_CUDA
} // namespace internal
} // namespace ceres
+5 -6
View File
@@ -107,15 +107,14 @@ namespace {
// 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
);
}
@@ -39,7 +39,6 @@ namespace internal {
// 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 {
-2
View File
@@ -50,7 +50,6 @@ namespace internal {
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 @@ class CERES_NO_EXPORT Graph {
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) {
+3 -3
View File
@@ -40,9 +40,9 @@ namespace ceres {
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,
@@ -58,7 +58,6 @@ class RegularizationCheckingLinearSolver : public DenseSparseMatrixSolver {
RegularizationCheckingLinearSolver(const int num_cols, const double* diagonal)
: num_cols_(num_cols), diagonal_(diagonal) {}
private:
LinearSolver::Summary SolveImpl(
DenseSparseMatrix* A,
-1
View File
@@ -111,7 +111,6 @@ TEST(ParameterBlock, SetManifoldAndNormalOperation) {
struct TestManifold : public Manifold {
public:
bool Plus(const double* x,
const double* delta,
double* x_plus_delta) const final {
+2 -1
View File
@@ -67,7 +67,8 @@ inline double EvaluatePolynomial(const Vector& polynomial, double x) {
// 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);
-1
View File
@@ -54,7 +54,6 @@
namespace ceres {
namespace internal {
const std::vector<ParameterBlock*>& Program::parameter_blocks() const {
return parameter_blocks_;
}
-1
View File
@@ -331,7 +331,6 @@ class NumParameterBlocksCostFunction : public CostFunction {
}
}
bool Evaluate(double const* const* parameters,
double* residuals,
double** jacobians) const final {
+2 -2
View File
@@ -80,8 +80,8 @@ class CERES_NO_EXPORT ResidualBlock {
// 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.
//