diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-05-10 17:36:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-05-10 18:01:20 +0300 |
commit | 3ad2597a4eca5091031c213445c6583e21097d5f (patch) | |
tree | f909af8ad783d1adea67911ddaf1633ad7f570a9 /extern/ceres/internal/ceres/block_jacobi_preconditioner.cc | |
parent | b4b85c5ce2752ea9241cbcfa1ddc3f639ad64262 (diff) |
Update Ceres to latest upstream version 2.1.0temp-ceres_update
This release deprecated the Parameterization API and the new Manifolds
API is to be used instead. This is what was done in the Libmv as part
of this change.
Additionally, remove the bundling scripts. Nowadays those are only
leading to a duplicated work to maintain.
Diffstat (limited to 'extern/ceres/internal/ceres/block_jacobi_preconditioner.cc')
-rw-r--r-- | extern/ceres/internal/ceres/block_jacobi_preconditioner.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/extern/ceres/internal/ceres/block_jacobi_preconditioner.cc b/extern/ceres/internal/ceres/block_jacobi_preconditioner.cc index 6f37aca553c..6e979dea93b 100644 --- a/extern/ceres/internal/ceres/block_jacobi_preconditioner.cc +++ b/extern/ceres/internal/ceres/block_jacobi_preconditioner.cc @@ -1,5 +1,5 @@ // Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2015 Google Inc. All rights reserved. +// Copyright 2022 Google Inc. All rights reserved. // http://ceres-solver.org/ // // Redistribution and use in source and binary forms, with or without @@ -47,10 +47,10 @@ BlockJacobiPreconditioner::BlockJacobiPreconditioner( blocks[i] = bs->cols[i].size; } - m_.reset(new BlockRandomAccessDiagonalMatrix(blocks)); + m_ = std::make_unique<BlockRandomAccessDiagonalMatrix>(blocks); } -BlockJacobiPreconditioner::~BlockJacobiPreconditioner() {} +BlockJacobiPreconditioner::~BlockJacobiPreconditioner() = default; bool BlockJacobiPreconditioner::UpdateImpl(const BlockSparseMatrix& A, const double* D) { @@ -60,21 +60,20 @@ bool BlockJacobiPreconditioner::UpdateImpl(const BlockSparseMatrix& A, for (int i = 0; i < bs->rows.size(); ++i) { const int row_block_size = bs->rows[i].block.size; const std::vector<Cell>& cells = bs->rows[i].cells; - for (int j = 0; j < cells.size(); ++j) { - const int block_id = cells[j].block_id; + for (const auto& cell : cells) { + const int block_id = cell.block_id; const int col_block_size = bs->cols[block_id].size; int r, c, row_stride, col_stride; CellInfo* cell_info = m_->GetCell(block_id, block_id, &r, &c, &row_stride, &col_stride); MatrixRef m(cell_info->values, row_stride, col_stride); - ConstMatrixRef b( - values + cells[j].position, row_block_size, col_block_size); + ConstMatrixRef b(values + cell.position, row_block_size, col_block_size); m.block(r, c, col_block_size, col_block_size) += b.transpose() * b; } } - if (D != NULL) { + if (D != nullptr) { // Add the diagonal. int position = 0; for (int i = 0; i < bs->cols.size(); ++i) { |