Several cleanups.
- Removes dead code.
- Changes to use std::make_unique.
Change-Id: I7921d78606554ca55fbedf719372749663b5464c
diff --git a/internal/ceres/coordinate_descent_minimizer.cc b/internal/ceres/coordinate_descent_minimizer.cc
index 298b604..8ecdeff 100644
--- a/internal/ceres/coordinate_descent_minimizer.cc
+++ b/internal/ceres/coordinate_descent_minimizer.cc
@@ -134,8 +134,6 @@
std::vector<std::unique_ptr<LinearSolver>> linear_solvers(
options.num_threads);
- // std::unique_ptr<LinearSolver*[]> linear_solvers(
- // new LinearSolver*[options.num_threads]);
LinearSolver::Options linear_solver_options;
linear_solver_options.type = DENSE_QR;
@@ -202,10 +200,6 @@
for (auto* parameter_block : parameter_blocks_) {
parameter_block->SetVarying();
}
-
- // for (int i = 0; i < options.num_threads; ++i) {
- // delete linear_solvers[i];
- //}
}
// Solve the optimization problem for one parameter block.
diff --git a/internal/ceres/covariance_impl.cc b/internal/ceres/covariance_impl.cc
index bc4e75f..9957d1d 100644
--- a/internal/ceres/covariance_impl.cc
+++ b/internal/ceres/covariance_impl.cc
@@ -321,9 +321,8 @@
// Assemble the blocks in the covariance matrix.
MatrixRef covariance(covariance_matrix, covariance_size, covariance_size);
const int num_threads = options_.num_threads;
- std::unique_ptr<double[]> workspace(
- new double[num_threads * max_covariance_block_size *
- max_covariance_block_size]);
+ auto workspace = std::make_unique<double[]>(
+ num_threads * max_covariance_block_size * max_covariance_block_size);
bool success = true;
@@ -682,7 +681,7 @@
// Since the covariance matrix is symmetric, the i^th row and column
// are equal.
const int num_threads = options_.num_threads;
- std::unique_ptr<double[]> workspace(new double[num_threads * num_cols]);
+ auto workspace = std::make_unique<double[]>(num_threads * num_cols);
problem_->context()->EnsureMinimumThreads(num_threads);
ParallelFor(
@@ -873,7 +872,7 @@
// are equal.
const int num_cols = jacobian.num_cols;
const int num_threads = options_.num_threads;
- std::unique_ptr<double[]> workspace(new double[num_threads * num_cols]);
+ auto workspace = std::make_unique<double[]>(num_threads * num_cols);
problem_->context()->EnsureMinimumThreads(num_threads);
ParallelFor(