mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Use const keyword for 'int thread_id' variables.
Change-Id: I3afdf8a472cbc4f325b462bc9c42c03bc464f4b2
This commit is contained in:
@@ -168,9 +168,9 @@ void CoordinateDescentMinimizer::Minimize(
|
||||
j < independent_set_offsets_[i + 1];
|
||||
++j) {
|
||||
#ifdef CERES_USE_OPENMP
|
||||
int thread_id = omp_get_thread_num();
|
||||
const int thread_id = omp_get_thread_num();
|
||||
#else
|
||||
int thread_id = 0;
|
||||
const int thread_id = 0;
|
||||
#endif
|
||||
|
||||
ParameterBlock* parameter_block = parameter_blocks_[j];
|
||||
|
||||
@@ -356,9 +356,9 @@ bool CovarianceImpl::GetCovarianceMatrixInTangentOrAmbientSpace(
|
||||
int size_i = parameter_sizes[i];
|
||||
int size_j = parameter_sizes[j];
|
||||
#ifdef CERES_USE_OPENMP
|
||||
int thread_id = omp_get_thread_num();
|
||||
const int thread_id = omp_get_thread_num();
|
||||
#else
|
||||
int thread_id = 0;
|
||||
const int thread_id = 0;
|
||||
#endif
|
||||
double* covariance_block =
|
||||
workspace.get() +
|
||||
@@ -705,9 +705,9 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingSuiteSparseQR() {
|
||||
}
|
||||
|
||||
# ifdef CERES_USE_OPENMP
|
||||
int thread_id = omp_get_thread_num();
|
||||
const int thread_id = omp_get_thread_num();
|
||||
# else
|
||||
int thread_id = 0;
|
||||
const int thread_id = 0;
|
||||
# endif
|
||||
|
||||
double* solution = workspace.get() + thread_id * num_cols;
|
||||
@@ -897,9 +897,9 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingEigenSparseQR() {
|
||||
}
|
||||
|
||||
# ifdef CERES_USE_OPENMP
|
||||
int thread_id = omp_get_thread_num();
|
||||
const int thread_id = omp_get_thread_num();
|
||||
# else
|
||||
int thread_id = 0;
|
||||
const int thread_id = 0;
|
||||
# endif
|
||||
|
||||
double* solution = workspace.get() + thread_id * num_cols;
|
||||
|
||||
@@ -183,9 +183,9 @@ class ProgramEvaluator : public Evaluator {
|
||||
}
|
||||
|
||||
#ifdef CERES_USE_OPENMP
|
||||
int thread_id = omp_get_thread_num();
|
||||
const int thread_id = omp_get_thread_num();
|
||||
#else
|
||||
int thread_id = 0;
|
||||
const int thread_id = 0;
|
||||
#endif
|
||||
EvaluatePreparer* preparer = &evaluate_preparers_[thread_id];
|
||||
EvaluateScratch* scratch = &evaluate_scratch_[thread_id];
|
||||
|
||||
@@ -224,9 +224,9 @@ Eliminate(const BlockSparseMatrix* A,
|
||||
#pragma omp parallel for num_threads(num_threads_) schedule(dynamic)
|
||||
for (int i = 0; i < chunks_.size(); ++i) {
|
||||
#ifdef CERES_USE_OPENMP
|
||||
int thread_id = omp_get_thread_num();
|
||||
const int thread_id = omp_get_thread_num();
|
||||
#else
|
||||
int thread_id = 0;
|
||||
const int thread_id = 0;
|
||||
#endif
|
||||
double* buffer = buffer_.get() + thread_id * buffer_size_;
|
||||
const Chunk& chunk = chunks_[i];
|
||||
@@ -509,9 +509,9 @@ ChunkOuterProduct(const CompressedRowBlockStructure* bs,
|
||||
BufferLayoutType::const_iterator it1 = buffer_layout.begin();
|
||||
|
||||
#ifdef CERES_USE_OPENMP
|
||||
int thread_id = omp_get_thread_num();
|
||||
const int thread_id = omp_get_thread_num();
|
||||
#else
|
||||
int thread_id = 0;
|
||||
const int thread_id = 0;
|
||||
#endif
|
||||
double* b1_transpose_inverse_ete =
|
||||
chunk_outer_product_buffer_.get() + thread_id * buffer_size_;
|
||||
|
||||
Reference in New Issue
Block a user