Eliminate benchmark deprecation warnings

Resolve the following warnings issue by the latest version of the
benchmark library:

/Users/runner/work/ceres-solver/ceres-solver/internal/ceres/small_blas_gemv_benchmark.cc:71:54: warning: 'Benchmark' is deprecated: Use ::benchmark::Benchmark instead [-Wdeprecated-declarations]
   71 | static void MatrixSizeArguments(benchmark::internal::Benchmark* benchmark) {
      |

/Users/runner/work/ceres-solver/ceres-solver/internal/ceres/dense_linear_solver_benchmark.cc:67:46: warning: 'Benchmark' is deprecated: Use ::benchmark::Benchmark instead [-Wdeprecated-declarations]
   67 | static void MatrixSizes(benchmark::internal::Benchmark* b) {
      |

/Users/runner/work/ceres-solver/ceres-solver/internal/ceres/invert_psd_matrix_benchmark.cc:80:37: warning: 'Benchmark' is deprecated: Use ::benchmark::Benchmark instead [-Wdeprecated-declarations]
   80 |     ->Apply([](benchmark::internal::Benchmark* benchmark) {
      |

Change-Id: Ice6fe57dc5635698809e368fda23a018f4d7df5a
This commit is contained in:
Sergiu Deitsch
2026-01-30 21:34:34 +01:00
parent 18887f1bd7
commit de96ed58f5
3 changed files with 14 additions and 14 deletions
@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2023 Google Inc. All rights reserved.
// Copyright 2026 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -64,7 +64,7 @@ static void BM_DenseSolver(benchmark::State& state) {
}
// Some reasonable matrix sizes. I picked them out of thin air.
static void MatrixSizes(benchmark::internal::Benchmark* b) {
const auto MatrixSizes = [](auto* b) {
// {num_rows, num_cols}
b->Args({1, 1});
b->Args({2, 1});
@@ -82,7 +82,7 @@ static void MatrixSizes(benchmark::internal::Benchmark* b) {
b->Args({400, 20});
b->Args({600, 22});
b->Args({800, 25});
}
};
BENCHMARK_TEMPLATE2(BM_DenseSolver, ceres::EIGEN, ceres::DENSE_QR)
->Apply(MatrixSizes);
@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2023 Google Inc. All rights reserved.
// Copyright 2026 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -76,12 +76,11 @@ static void BenchmarkDynamicallyInvertPSDMatrix(benchmark::State& state) {
}
}
BENCHMARK(BenchmarkDynamicallyInvertPSDMatrix)
->Apply([](benchmark::internal::Benchmark* benchmark) {
BENCHMARK(BenchmarkDynamicallyInvertPSDMatrix)->Apply([](auto* benchmark) {
for (int i = 1; i < 13; ++i) {
benchmark->Args({i});
}
});
});
} // namespace ceres::internal
+5 -4
View File
@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2023 Google Inc. All rights reserved.
// Copyright 2026 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@ class MatrixVectorMultiplyData {
// Helper function to generate the various matrix sizes for which we
// run the benchmark.
static void MatrixSizeArguments(benchmark::internal::Benchmark* benchmark) {
const auto MatrixSizeArguments = [](auto* benchmark) {
std::vector<int> rows = {1, 2, 3, 4, 6, 8};
std::vector<int> cols = {1, 2, 3, 4, 8, 12, 15};
for (int r : rows) {
@@ -76,9 +76,10 @@ static void MatrixSizeArguments(benchmark::internal::Benchmark* benchmark) {
benchmark->Args({r, c});
}
}
}
};
static void BM_MatrixVectorMultiply(benchmark::State& state) {
static void
BM_MatrixVectorMultiply(benchmark::State & state) {
const int rows = state.range(0);
const int cols = state.range(1);
MatrixVectorMultiplyData data(rows, cols);