Clean up legacy SuiteSparse, Benchmark, and GTest compatibility shims
Remove workarounds that are no longer needed under the raised SuiteSparse
7.6.1, Google Benchmark 1.8.3, Eigen 3.4.0, and GoogleTest 1.14.0
minimum versions:
- Replace deprecated SuiteSparse_long with int64_t in covariance_impl.cc.
- Drop unnecessary const_cast<char*> on cholmod_print_{common,sparse,
dense,triplet} in suitesparse.{h,cc}.
- Call ::benchmark::Shutdown() directly in evaluation_benchmark.cc and
replace manual Arg() lists and macros in parallel_for_benchmark.cc and
parallel_vector_operations_benchmark.cc with ArgsProduct and Ranges.
- Replace ::testing::tuple and ::testing::get with std::tuple and
std::get, and remove legacy GTEST_HAS_TYPED_TEST guards and stale
Eigen 3.3 comments.
Change-Id: I54e1d8072c9c4ce9e62610a7cdc5dafb629b820b
diff --git a/internal/ceres/accurate_norm_test.cc b/internal/ceres/accurate_norm_test.cc
index e5d0570..7397068 100644
--- a/internal/ceres/accurate_norm_test.cc
+++ b/internal/ceres/accurate_norm_test.cc
@@ -111,8 +111,6 @@
EXPECT_EQ(ceres::AccurateRNorm(3, 4, 0), 0.2);
}
-#if GTEST_HAS_TYPED_TEST
-
template <typename T>
class AccurateNormTest : public testing::Test {
public:
@@ -679,5 +677,3 @@
EXPECT_EQ(std::memcmp(&first, &expected, sizeof(double)), 0);
EXPECT_EQ(std::memcmp(&last, &expected, sizeof(double)), 0);
}
-
-#endif
diff --git a/internal/ceres/compressed_row_sparse_matrix_test.cc b/internal/ceres/compressed_row_sparse_matrix_test.cc
index 5223dcb..2c1bd15 100644
--- a/internal/ceres/compressed_row_sparse_matrix_test.cc
+++ b/internal/ceres/compressed_row_sparse_matrix_test.cc
@@ -35,6 +35,7 @@
#include <numeric>
#include <random>
#include <string>
+#include <tuple>
#include <vector>
#include "Eigen/SparseCore"
@@ -376,15 +377,15 @@
}
}
-using Param = ::testing::tuple<CompressedRowSparseMatrix::StorageType>;
+using Param = std::tuple<CompressedRowSparseMatrix::StorageType>;
static std::string ParamInfoToString(testing::TestParamInfo<Param> info) {
- if (::testing::get<0>(info.param) ==
+ if (std::get<0>(info.param) ==
CompressedRowSparseMatrix::StorageType::UPPER_TRIANGULAR) {
return "UPPER";
}
- if (::testing::get<0>(info.param) ==
+ if (std::get<0>(info.param) ==
CompressedRowSparseMatrix::StorageType::LOWER_TRIANGULAR) {
return "LOWER";
}
@@ -415,7 +416,7 @@
options.min_row_block_size = kMinBlockSize;
options.max_row_block_size = kMaxBlockSize;
options.block_density = uniform(prng);
- options.storage_type = ::testing::get<0>(param);
+ options.storage_type = std::get<0>(param);
auto matrix =
CompressedRowSparseMatrix::CreateRandomMatrix(options, prng);
const int num_rows = matrix->num_rows();
@@ -431,10 +432,10 @@
Matrix dense;
matrix->ToDenseMatrix(&dense);
Vector expected_y;
- if (::testing::get<0>(param) ==
+ if (std::get<0>(param) ==
CompressedRowSparseMatrix::StorageType::UPPER_TRIANGULAR) {
expected_y = dense.selfadjointView<Eigen::Upper>() * x;
- } else if (::testing::get<0>(param) ==
+ } else if (std::get<0>(param) ==
CompressedRowSparseMatrix::StorageType::LOWER_TRIANGULAR) {
expected_y = dense.selfadjointView<Eigen::Lower>() * x;
} else {
@@ -485,7 +486,7 @@
options.min_row_block_size = kMinBlockSize;
options.max_row_block_size = kMaxBlockSize;
options.block_density = uniform(prng);
- options.storage_type = ::testing::get<0>(param);
+ options.storage_type = std::get<0>(param);
auto matrix =
CompressedRowSparseMatrix::CreateRandomMatrix(options, prng);
const int num_rows = matrix->num_rows();
@@ -501,10 +502,10 @@
Matrix dense;
matrix->ToDenseMatrix(&dense);
Vector expected_y;
- if (::testing::get<0>(param) ==
+ if (std::get<0>(param) ==
CompressedRowSparseMatrix::StorageType::UPPER_TRIANGULAR) {
expected_y = dense.selfadjointView<Eigen::Upper>() * x;
- } else if (::testing::get<0>(param) ==
+ } else if (std::get<0>(param) ==
CompressedRowSparseMatrix::StorageType::LOWER_TRIANGULAR) {
expected_y = dense.selfadjointView<Eigen::Lower>() * x;
} else {
@@ -555,7 +556,7 @@
options.min_row_block_size = kMinBlockSize;
options.max_row_block_size = kMaxBlockSize;
options.block_density = uniform(prng);
- options.storage_type = ::testing::get<0>(param);
+ options.storage_type = std::get<0>(param);
auto matrix =
CompressedRowSparseMatrix::CreateRandomMatrix(options, prng);
const int num_cols = matrix->num_cols();
@@ -567,11 +568,11 @@
Matrix dense;
matrix->ToDenseMatrix(&dense);
Vector expected;
- if (::testing::get<0>(param) ==
+ if (std::get<0>(param) ==
CompressedRowSparseMatrix::StorageType::UPPER_TRIANGULAR) {
const Matrix full = dense.selfadjointView<Eigen::Upper>();
expected = full.colwise().squaredNorm();
- } else if (::testing::get<0>(param) ==
+ } else if (std::get<0>(param) ==
CompressedRowSparseMatrix::StorageType::LOWER_TRIANGULAR) {
const Matrix full = dense.selfadjointView<Eigen::Lower>();
expected = full.colwise().squaredNorm();
diff --git a/internal/ceres/covariance_impl.cc b/internal/ceres/covariance_impl.cc
index 7fc216c..6f5b42a 100644
--- a/internal/ceres/covariance_impl.cc
+++ b/internal/ceres/covariance_impl.cc
@@ -31,6 +31,7 @@
#include "ceres/covariance_impl.h"
#include <algorithm>
+#include <cstdint>
#include <cstdlib>
#include <memory>
#include <numeric>
@@ -555,8 +556,8 @@
const int num_cols = jacobian.num_cols;
const int num_nonzeros = jacobian.values.size();
- std::vector<SuiteSparse_long> transpose_rows(num_cols + 1, 0);
- std::vector<SuiteSparse_long> transpose_cols(num_nonzeros, 0);
+ std::vector<int64_t> transpose_rows(num_cols + 1, 0);
+ std::vector<int64_t> transpose_cols(num_nonzeros, 0);
std::vector<double> transpose_values(num_nonzeros, 0);
for (int idx = 0; idx < num_nonzeros; ++idx) {
@@ -602,7 +603,7 @@
cholmod_l_start(&cc);
cholmod_sparse* R = nullptr;
- SuiteSparse_long* permutation = nullptr;
+ int64_t* permutation = nullptr;
// Compute a Q-less QR factorization of the Jacobian. Since we are
// only interested in inverting J'J = R'R, we do not need Q. This
@@ -617,7 +618,7 @@
// more efficient, both in runtime as well as the quality of
// ordering computed. So, it maybe worth doing that analysis
// separately.
- const SuiteSparse_long rank = SuiteSparseQR<double>(
+ const int64_t rank = SuiteSparseQR<double>(
SPQR_ORDERING_BESTAMD,
options_.column_pivot_threshold < 0 ? SPQR_DEFAULT_TOL
: options_.column_pivot_threshold,
@@ -646,11 +647,11 @@
std::vector<int> inverse_permutation(num_cols);
if (permutation) {
- for (SuiteSparse_long i = 0; i < num_cols; ++i) {
+ for (int64_t i = 0; i < num_cols; ++i) {
inverse_permutation[permutation[i]] = i;
}
} else {
- for (SuiteSparse_long i = 0; i < num_cols; ++i) {
+ for (int64_t i = 0; i < num_cols; ++i) {
inverse_permutation[i] = i;
}
}
@@ -678,13 +679,12 @@
const int row_end = rows[r + 1];
if (row_end != row_begin) {
double* solution = workspace.get() + thread_id * num_cols;
- SolveRTRWithSparseRHS<SuiteSparse_long>(
- num_cols,
- static_cast<SuiteSparse_long*>(R->i),
- static_cast<SuiteSparse_long*>(R->p),
- static_cast<double*>(R->x),
- inverse_permutation[r],
- solution);
+ SolveRTRWithSparseRHS<int64_t>(num_cols,
+ static_cast<int64_t*>(R->i),
+ static_cast<int64_t*>(R->p),
+ static_cast<double*>(R->x),
+ inverse_permutation[r],
+ solution);
for (int idx = row_begin; idx < row_end; ++idx) {
const int c = cols[idx];
values[idx] = solution[inverse_permutation[c]];
diff --git a/internal/ceres/evaluation_benchmark.cc b/internal/ceres/evaluation_benchmark.cc
index 45faf32..e6005e8 100644
--- a/internal/ceres/evaluation_benchmark.cc
+++ b/internal/ceres/evaluation_benchmark.cc
@@ -800,14 +800,6 @@
} // namespace ceres::internal
-// Older versions of benchmark library might come without ::benchmark::Shutdown
-// function. We provide an empty fallback variant of Shutdown function in
-// order to support both older and newer versions
-namespace benchmark_shutdown_fallback {
-template <typename... Args>
-void Shutdown(Args... args) {}
-}; // namespace benchmark_shutdown_fallback
-
int main(int argc, char** argv) {
::benchmark::Initialize(&argc, argv);
@@ -1135,9 +1127,6 @@
#endif
}
::benchmark::RunSpecifiedBenchmarks();
-
- using namespace ::benchmark;
- using namespace benchmark_shutdown_fallback;
- Shutdown();
+ ::benchmark::Shutdown();
return 0;
}
diff --git a/internal/ceres/jet_test.cc b/internal/ceres/jet_test.cc
index bc982d1..419378a 100644
--- a/internal/ceres/jet_test.cc
+++ b/internal/ceres/jet_test.cc
@@ -1307,7 +1307,6 @@
}
}
-// ScalarBinaryOpTraits is only supported on Eigen versions >= 3.3
TEST(JetTraitsTest, MatrixScalarUnaryOps) {
const J x = MakeJet(2.3, -2.7, 1e-3);
const J y = MakeJet(1.7, 0.5, 1e+2);
@@ -1409,8 +1408,6 @@
ExpectClose(e.v[0].v[0].v[0], kE, kTolerance);
}
-#if GTEST_HAS_TYPED_TEST
-
using Types = testing::Types<std::int16_t,
std::uint16_t,
std::int32_t,
@@ -1491,8 +1488,6 @@
EXPECT_NE(Scalar{2}, J0<J0<J0d>>{J0<J0d>{J0d{1.0}}});
}
-#endif // GTEST_HAS_TYPED_TEST
-
} // namespace ceres::internal
#ifdef _MSC_VER
diff --git a/internal/ceres/parallel_for_benchmark.cc b/internal/ceres/parallel_for_benchmark.cc
index 118bbb8..e48ecc8 100644
--- a/internal/ceres/parallel_for_benchmark.cc
+++ b/internal/ceres/parallel_for_benchmark.cc
@@ -50,26 +50,7 @@
CHECK_EQ(x.squaredNorm(), 0.);
}
BENCHMARK(SchedulerBenchmark)
- ->Args({128, 1})
- ->Args({128, 2})
- ->Args({128, 4})
- ->Args({128, 8})
- ->Args({128, 16})
- ->Args({256, 1})
- ->Args({256, 2})
- ->Args({256, 4})
- ->Args({256, 8})
- ->Args({256, 16})
- ->Args({1024, 1})
- ->Args({1024, 2})
- ->Args({1024, 4})
- ->Args({1024, 8})
- ->Args({1024, 16})
- ->Args({4096, 1})
- ->Args({4096, 2})
- ->Args({4096, 4})
- ->Args({4096, 8})
- ->Args({4096, 16});
+ ->ArgsProduct({{128, 256, 1024, 4096}, {1, 2, 4, 8, 16}});
} // namespace ceres::internal
diff --git a/internal/ceres/parallel_vector_operations_benchmark.cc b/internal/ceres/parallel_vector_operations_benchmark.cc
index c3dcdb4..85b926f 100644
--- a/internal/ceres/parallel_vector_operations_benchmark.cc
+++ b/internal/ceres/parallel_vector_operations_benchmark.cc
@@ -38,33 +38,6 @@
// polymorphic functions that define benchmark and which could be defined in the
// ceres namespace.
namespace {
-// Older versions of benchmark library (for example, one shipped with
-// ubuntu 20.04) do not support range generation and range products
-#define VECTOR_SIZES(num_threads) \
- Args({1 << 7, num_threads}) \
- ->Args({1 << 8, num_threads}) \
- ->Args({1 << 9, num_threads}) \
- ->Args({1 << 10, num_threads}) \
- ->Args({1 << 11, num_threads}) \
- ->Args({1 << 12, num_threads}) \
- ->Args({1 << 13, num_threads}) \
- ->Args({1 << 14, num_threads}) \
- ->Args({1 << 15, num_threads}) \
- ->Args({1 << 16, num_threads}) \
- ->Args({1 << 17, num_threads}) \
- ->Args({1 << 18, num_threads}) \
- ->Args({1 << 19, num_threads}) \
- ->Args({1 << 20, num_threads}) \
- ->Args({1 << 21, num_threads}) \
- ->Args({1 << 22, num_threads}) \
- ->Args({1 << 23, num_threads})
-
-#define VECTOR_SIZE_THREADS \
- VECTOR_SIZES(1) \
- ->VECTOR_SIZES(2) \
- ->VECTOR_SIZES(4) \
- ->VECTOR_SIZES(8) \
- ->VECTOR_SIZES(16)
static void SetZero(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -74,7 +47,7 @@
}
CHECK_EQ(x.squaredNorm(), 0.);
}
-BENCHMARK(SetZero)->VECTOR_SIZES(1);
+BENCHMARK(SetZero)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void SetZeroParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -88,7 +61,9 @@
}
CHECK_EQ(x.squaredNorm(), 0.);
}
-BENCHMARK(SetZeroParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(SetZeroParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
static void Negate(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -100,7 +75,7 @@
}
CHECK((x - x_init).squaredNorm() == 0. || (x + x_init).squaredNorm() == 0);
}
-BENCHMARK(Negate)->VECTOR_SIZES(1);
+BENCHMARK(Negate)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void NegateParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -116,7 +91,9 @@
}
CHECK((x - x_init).squaredNorm() == 0. || (x + x_init).squaredNorm() == 0);
}
-BENCHMARK(NegateParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(NegateParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
static void Assign(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -127,7 +104,7 @@
}
CHECK_EQ((y - x).squaredNorm(), 0.);
}
-BENCHMARK(Assign)->VECTOR_SIZES(1);
+BENCHMARK(Assign)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void AssignParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -143,7 +120,9 @@
}
CHECK_EQ((y - x).squaredNorm(), 0.);
}
-BENCHMARK(AssignParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(AssignParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
static void D2X(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -155,7 +134,7 @@
}
CHECK_GT(y.squaredNorm(), 0.);
}
-BENCHMARK(D2X)->VECTOR_SIZES(1);
+BENCHMARK(D2X)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void D2XParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -172,7 +151,9 @@
}
CHECK_GT(y.squaredNorm(), 0.);
}
-BENCHMARK(D2XParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(D2XParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
static void DivideSqrt(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -183,7 +164,7 @@
}
CHECK_GT(diagonal.squaredNorm(), 0.);
}
-BENCHMARK(DivideSqrt)->VECTOR_SIZES(1);
+BENCHMARK(DivideSqrt)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void DivideSqrtParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -199,7 +180,9 @@
}
CHECK_GT(diagonal.squaredNorm(), 0.);
}
-BENCHMARK(DivideSqrtParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(DivideSqrtParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
static void Clamp(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -214,7 +197,7 @@
CHECK_LE(diagonal.maxCoeff(), 0.5);
CHECK_GE(diagonal.minCoeff(), -0.5);
}
-BENCHMARK(Clamp)->VECTOR_SIZES(1);
+BENCHMARK(Clamp)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void ClampParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -232,7 +215,9 @@
CHECK_LE(diagonal.maxCoeff(), 0.5);
CHECK_GE(diagonal.minCoeff(), -0.5);
}
-BENCHMARK(ClampParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(ClampParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
static void Norm(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -244,7 +229,7 @@
}
CHECK_GT(total, 0.);
}
-BENCHMARK(Norm)->VECTOR_SIZES(1);
+BENCHMARK(Norm)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void NormParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -260,7 +245,9 @@
}
CHECK_GT(total, 0.);
}
-BENCHMARK(NormParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(NormParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
static void Dot(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -273,7 +260,7 @@
}
CHECK_NE(total, 0.);
}
-BENCHMARK(Dot)->VECTOR_SIZES(1);
+BENCHMARK(Dot)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void DotParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -290,7 +277,9 @@
}
CHECK_NE(total, 0.);
}
-BENCHMARK(DotParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(DotParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
static void Axpby(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -305,7 +294,7 @@
}
CHECK_GT(z.squaredNorm(), 0.);
}
-BENCHMARK(Axpby)->VECTOR_SIZES(1);
+BENCHMARK(Axpby)->RangeMultiplier(2)->Range(1 << 7, 1 << 23);
static void AxpbyParallel(benchmark::State& state) {
const int kVectorSize = static_cast<int>(state.range(0));
@@ -324,7 +313,9 @@
}
CHECK_GT(z.squaredNorm(), 0.);
}
-BENCHMARK(AxpbyParallel)->VECTOR_SIZE_THREADS;
+BENCHMARK(AxpbyParallel)
+ ->RangeMultiplier(2)
+ ->Ranges({{1 << 7, 1 << 23}, {1, 16}});
} // namespace
} // namespace ceres::internal
diff --git a/internal/ceres/sparse_cholesky_test.cc b/internal/ceres/sparse_cholesky_test.cc
index 6985dbc..1749128 100644
--- a/internal/ceres/sparse_cholesky_test.cc
+++ b/internal/ceres/sparse_cholesky_test.cc
@@ -35,6 +35,7 @@
#include <random>
#include <sstream>
#include <string>
+#include <tuple>
#include <utility>
#include <vector>
@@ -176,15 +177,15 @@
// OrderingType
// BlockStructure
using Param =
- ::testing::tuple<SparseLinearAlgebraLibraryType, bool, OrderingType, bool>;
+ std::tuple<SparseLinearAlgebraLibraryType, bool, OrderingType, bool>;
std::string ParamInfoToString(testing::TestParamInfo<Param> info) {
Param param = info.param;
std::stringstream ss;
- ss << SparseLinearAlgebraLibraryTypeToString(::testing::get<0>(param)) << "_"
- << (::testing::get<1>(param) ? "FLOAT" : "DOUBLE") << "_"
- << ::testing::get<2>(param) << "_"
- << (::testing::get<3>(param) ? "UseBlockStructure" : "NoBlockStructure");
+ ss << SparseLinearAlgebraLibraryTypeToString(std::get<0>(param)) << "_"
+ << (std::get<1>(param) ? "FLOAT" : "DOUBLE") << "_" << std::get<2>(param)
+ << "_"
+ << (std::get<3>(param) ? "UseBlockStructure" : "NoBlockStructure");
return ss.str();
}
@@ -208,10 +209,10 @@
++num_blocks) {
for (int trial = 0; trial < kNumTrials; ++trial) {
const double block_density = distribution(prng);
- SparseCholeskySolverUnitTest(::testing::get<0>(param),
- ::testing::get<1>(param),
- ::testing::get<2>(param),
- ::testing::get<3>(param),
+ SparseCholeskySolverUnitTest(std::get<0>(param),
+ std::get<1>(param),
+ std::get<2>(param),
+ std::get<3>(param),
num_blocks,
kMinBlockSize,
kMaxBlockSize,
diff --git a/internal/ceres/subset_preconditioner_test.cc b/internal/ceres/subset_preconditioner_test.cc
index ffd11d4..016a845 100644
--- a/internal/ceres/subset_preconditioner_test.cc
+++ b/internal/ceres/subset_preconditioner_test.cc
@@ -32,6 +32,7 @@
#include <memory>
#include <random>
+#include <tuple>
#include "Eigen/Dense"
#include "Eigen/SparseCore"
@@ -76,13 +77,13 @@
dense_triangular_lhs, rhs, solution);
}
-using Param = ::testing::tuple<SparseLinearAlgebraLibraryType, bool>;
+using Param = std::tuple<SparseLinearAlgebraLibraryType, bool>;
std::string ParamInfoToString(testing::TestParamInfo<Param> info) {
Param param = info.param;
std::stringstream ss;
- ss << SparseLinearAlgebraLibraryTypeToString(::testing::get<0>(param)) << "_"
- << (::testing::get<1>(param) ? "Diagonal" : "NoDiagonal");
+ ss << SparseLinearAlgebraLibraryTypeToString(std::get<0>(param)) << "_"
+ << (std::get<1>(param) ? "Diagonal" : "NoDiagonal");
return ss.str();
}
@@ -139,10 +140,10 @@
Param param = GetParam();
Preconditioner::Options options;
options.subset_preconditioner_start_row_block = start_row_block_;
- options.sparse_linear_algebra_library_type = ::testing::get<0>(param);
+ options.sparse_linear_algebra_library_type = std::get<0>(param);
preconditioner_ = std::make_unique<SubsetPreconditioner>(options, *m_);
- const bool with_diagonal = ::testing::get<1>(param);
+ const bool with_diagonal = std::get<1>(param);
if (!with_diagonal) {
m_->AppendRows(*block_diagonal_);
}
diff --git a/internal/ceres/suitesparse.cc b/internal/ceres/suitesparse.cc
index a158918..9440f9c 100644
--- a/internal/ceres/suitesparse.cc
+++ b/internal/ceres/suitesparse.cc
@@ -186,7 +186,7 @@
CHECK(factor != nullptr);
if (VLOG_IS_ON(2)) {
- cholmod_print_common(const_cast<char*>("Symbolic Analysis"), &cc_);
+ cholmod_print_common("Symbolic Analysis", &cc_);
}
return factor;
@@ -209,7 +209,7 @@
CHECK(factor != nullptr);
if (VLOG_IS_ON(2)) {
- cholmod_print_common(const_cast<char*>("Symbolic Analysis"), &cc_);
+ cholmod_print_common("Symbolic Analysis", &cc_);
}
return factor;
diff --git a/internal/ceres/suitesparse.h b/internal/ceres/suitesparse.h
index 11b136d..18c54f4 100644
--- a/internal/ceres/suitesparse.h
+++ b/internal/ceres/suitesparse.h
@@ -229,15 +229,15 @@
void Free(cholmod_factor* m) { cholmod_free_factor(&m, &cc_); }
void Print(cholmod_sparse* m, const std::string& name) {
- cholmod_print_sparse(m, const_cast<char*>(name.c_str()), &cc_);
+ cholmod_print_sparse(m, name.c_str(), &cc_);
}
void Print(cholmod_dense* m, const std::string& name) {
- cholmod_print_dense(m, const_cast<char*>(name.c_str()), &cc_);
+ cholmod_print_dense(m, name.c_str(), &cc_);
}
void Print(cholmod_triplet* m, const std::string& name) {
- cholmod_print_triplet(m, const_cast<char*>(name.c_str()), &cc_);
+ cholmod_print_triplet(m, name.c_str(), &cc_);
}
cholmod_common* mutable_cc() { return &cc_; }