ClangTidy cleanups Change-Id: I514ca5fd91c08866b412021e6c0f5d6f97c4bf8f
diff --git a/internal/ceres/iterative_schur_complement_solver.cc b/internal/ceres/iterative_schur_complement_solver.cc index 0d0daaa..5f56be2 100644 --- a/internal/ceres/iterative_schur_complement_solver.cc +++ b/internal/ceres/iterative_schur_complement_solver.cc
@@ -95,7 +95,7 @@ reduced_linear_system_solution_.setZero(); CreatePreconditioner(A); - if (preconditioner_.get() != nullptr) { + if (preconditioner_ != nullptr) { if (!preconditioner_->Update(*A, per_solve_options.D)) { LinearSolver::Summary summary; summary.num_iterations = 0; @@ -141,7 +141,7 @@ void IterativeSchurComplementSolver::CreatePreconditioner( BlockSparseMatrix* A) { - if (preconditioner_.get() != nullptr) { + if (preconditioner_ != nullptr) { return; }
diff --git a/internal/ceres/linear_least_squares_problems.cc b/internal/ceres/linear_least_squares_problems.cc index b8633aa..6cee2f6 100644 --- a/internal/ceres/linear_least_squares_problems.cc +++ b/internal/ceres/linear_least_squares_problems.cc
@@ -88,8 +88,7 @@ 2.82327586;] */ std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem0() { - std::unique_ptr<LinearLeastSquaresProblem> problem = - std::make_unique<LinearLeastSquaresProblem>(); + auto problem = std::make_unique<LinearLeastSquaresProblem>(); auto A = std::make_unique<TripletSparseMatrix>(3, 2, 6); problem->b = std::make_unique<double[]>(3); @@ -190,8 +189,8 @@ int num_rows = 6; int num_cols = 5; - std::unique_ptr<LinearLeastSquaresProblem> problem = - std::make_unique<LinearLeastSquaresProblem>(); + auto problem = std::make_unique<LinearLeastSquaresProblem>(); + auto A = std::make_unique<TripletSparseMatrix>( num_rows, num_cols, num_rows * num_cols); problem->b = std::make_unique<double[]>(num_rows); @@ -302,8 +301,7 @@ int num_rows = 6; int num_cols = 5; - std::unique_ptr<LinearLeastSquaresProblem> problem = - std::make_unique<LinearLeastSquaresProblem>(); + auto problem = std::make_unique<LinearLeastSquaresProblem>(); problem->b = std::make_unique<double[]>(num_rows); problem->D = std::make_unique<double[]>(num_cols); @@ -317,8 +315,7 @@ problem->x[4] = 0.1388; auto* bs = new CompressedRowBlockStructure; - std::unique_ptr<double[]> values = - std::make_unique<double[]>(num_rows * num_cols); + auto values = std::make_unique<double[]>(num_rows * num_cols); for (int c = 0; c < num_cols; ++c) { bs->cols.emplace_back(); @@ -444,16 +441,14 @@ int num_rows = 5; int num_cols = 2; - std::unique_ptr<LinearLeastSquaresProblem> problem = - std::make_unique<LinearLeastSquaresProblem>(); + auto problem = std::make_unique<LinearLeastSquaresProblem>(); problem->b = std::make_unique<double[]>(num_rows); problem->D = std::make_unique<double[]>(num_cols); problem->num_eliminate_blocks = 2; auto* bs = new CompressedRowBlockStructure; - std::unique_ptr<double[]> values = - std::make_unique<double[]>(num_rows * num_cols); + auto values = std::make_unique<double[]>(num_rows * num_cols); for (int c = 0; c < num_cols; ++c) { bs->cols.emplace_back(); @@ -553,16 +548,14 @@ int num_rows = 3; int num_cols = 7; - std::unique_ptr<LinearLeastSquaresProblem> problem = - std::make_unique<LinearLeastSquaresProblem>(); + auto problem = std::make_unique<LinearLeastSquaresProblem>(); problem->b = std::make_unique<double[]>(num_rows); problem->D = std::make_unique<double[]>(num_cols); problem->num_eliminate_blocks = 1; auto* bs = new CompressedRowBlockStructure; - std::unique_ptr<double[]> values = - std::make_unique<double[]>(num_rows * num_cols); + auto values = std::make_unique<double[]>(num_rows * num_cols); // Column block structure bs->cols.emplace_back(); @@ -685,9 +678,7 @@ int num_rows = 6; int num_cols = 5; - std::unique_ptr<LinearLeastSquaresProblem> problem = - std::make_unique<LinearLeastSquaresProblem>(); - + auto problem = std::make_unique<LinearLeastSquaresProblem>(); problem->b = std::make_unique<double[]>(num_rows); problem->D = std::make_unique<double[]>(num_cols); problem->num_eliminate_blocks = 2; @@ -701,8 +692,7 @@ problem->x[4] = 0.1; auto* bs = new CompressedRowBlockStructure; - std::unique_ptr<double[]> values = - std::make_unique<double[]>(num_rows * num_cols); + auto values = std::make_unique<double[]>(num_rows * num_cols); for (int c = 0; c < num_cols; ++c) { bs->cols.emplace_back();
diff --git a/internal/ceres/schur_complement_solver.cc b/internal/ceres/schur_complement_solver.cc index 1f10ac2..5c81c33 100644 --- a/internal/ceres/schur_complement_solver.cc +++ b/internal/ceres/schur_complement_solver.cc
@@ -114,7 +114,7 @@ EventLogger event_logger("SchurComplementSolver::Solve"); const CompressedRowBlockStructure* bs = A->block_structure(); - if (eliminator_.get() == nullptr) { + if (eliminator_ == nullptr) { const int num_eliminate_blocks = options_.elimination_groups[0]; const int num_f_blocks = bs->cols.size() - num_eliminate_blocks; @@ -354,7 +354,7 @@ // Only SCHUR_JACOBI is supported over here right now. CHECK_EQ(options().preconditioner_type, SCHUR_JACOBI); - if (preconditioner_.get() == nullptr) { + if (preconditioner_ == nullptr) { preconditioner_ = std::make_unique<BlockRandomAccessDiagonalMatrix>(blocks_); }
diff --git a/internal/ceres/solver_test.cc b/internal/ceres/solver_test.cc index 3f9f8a1..b4b2d34 100644 --- a/internal/ceres/solver_test.cc +++ b/internal/ceres/solver_test.cc
@@ -33,6 +33,7 @@ #include <cmath> #include <limits> #include <memory> +#include <string> #include <vector> #include "ceres/autodiff_cost_function.h"