mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Several cleanups.
- Removes dead code. - Changes to use std::make_unique. Change-Id: I7921d78606554ca55fbedf719372749663b5464c
This commit is contained in:
@@ -134,8 +134,6 @@ void CoordinateDescentMinimizer::Minimize(const Minimizer::Options& options,
|
||||
|
||||
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 @@ void CoordinateDescentMinimizer::Minimize(const Minimizer::Options& options,
|
||||
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.
|
||||
|
||||
@@ -321,9 +321,8 @@ bool CovarianceImpl::GetCovarianceMatrixInTangentOrAmbientSpace(
|
||||
// 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 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingSuiteSparseQR() {
|
||||
// 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 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingEigenSparseQR() {
|
||||
// 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(
|
||||
|
||||
Reference in New Issue
Block a user