Replacing old style typedefs with new style usings

Change-Id: I85d353708fc431df8312a2337d0508df6aee071f
This commit is contained in:
Alexander Ivanov
2023-01-12 09:09:35 +00:00
parent 53df5ddcfd
commit 772d927e19
4 changed files with 26 additions and 27 deletions
+8 -8
View File
@@ -55,18 +55,18 @@ struct SparseTypesTrait {};
template <>
struct SparseTypesTrait<double> {
typedef DenseVector_Double DenseVector;
typedef SparseMatrix_Double SparseMatrix;
typedef SparseOpaqueSymbolicFactorization SymbolicFactorization;
typedef SparseOpaqueFactorization_Double NumericFactorization;
using DenseVector = DenseVector_Double;
using SparseMatrix = SparseMatrix_Double;
using SymbolicFactorization = SparseOpaqueSymbolicFactorization;
using NumericFactorization = SparseOpaqueFactorization_Double;
};
template <>
struct SparseTypesTrait<float> {
typedef DenseVector_Float DenseVector;
typedef SparseMatrix_Float SparseMatrix;
typedef SparseOpaqueSymbolicFactorization SymbolicFactorization;
typedef SparseOpaqueFactorization_Float NumericFactorization;
using DenseVector = DenseVector_Float;
using SparseMatrix = SparseMatrix_Float;
using SymbolicFactorization = SparseOpaqueSymbolicFactorization;
using NumericFactorization = SparseOpaqueFactorization_Float;
};
template <typename Scalar>
+13 -14
View File
@@ -298,20 +298,19 @@ class DynamicTwoParameterBlockFunctor {
};
// Check that AutoDiff(Functor1) == AutoDiff(CostToFunctor(AutoDiff(Functor1)))
#define TEST_BODY(Functor1) \
TEST(CostFunctionToFunctor, Functor1) { \
typedef AutoDiffCostFunction<Functor1, 2, PARAMETER_BLOCK_SIZES> \
CostFunction1; \
typedef CostFunctionToFunctor<2, PARAMETER_BLOCK_SIZES> FunctionToFunctor; \
typedef AutoDiffCostFunction<FunctionToFunctor, 2, PARAMETER_BLOCK_SIZES> \
CostFunction2; \
\
std::unique_ptr<CostFunction> cost_function(new CostFunction2( \
new FunctionToFunctor(new CostFunction1(new Functor1)))); \
\
std::unique_ptr<CostFunction> actual_cost_function( \
new CostFunction1(new Functor1)); \
ExpectCostFunctionsAreEqual(*cost_function, *actual_cost_function); \
#define TEST_BODY(Functor1) \
TEST(CostFunctionToFunctor, Functor1) { \
using CostFunction1 = AutoDiffCostFunction<Functor1, 2, PARAMETER_BLOCK_SIZES>; \
using FunctionToFunctor = CostFunctionToFunctor<2, PARAMETER_BLOCK_SIZES>; \
using CostFunction2 = \
AutoDiffCostFunction<FunctionToFunctor, 2, PARAMETER_BLOCK_SIZES>; \
\
std::unique_ptr<CostFunction> cost_function(new CostFunction2( \
new FunctionToFunctor(new CostFunction1(new Functor1)))); \
\
std::unique_ptr<CostFunction> actual_cost_function( \
new CostFunction1(new Functor1)); \
ExpectCostFunctionsAreEqual(*cost_function, *actual_cost_function); \
}
#define PARAMETER_BLOCK_SIZES 2
+4 -4
View File
@@ -392,10 +392,10 @@ class TypedLinearSolver : public LinearSolver {
// Linear solvers that depend on access to the low level structure of
// a SparseMatrix.
// clang-format off
typedef TypedLinearSolver<BlockSparseMatrix> BlockSparseMatrixSolver; // NOLINT
typedef TypedLinearSolver<CompressedRowSparseMatrix> CompressedRowSparseMatrixSolver; // NOLINT
typedef TypedLinearSolver<DenseSparseMatrix> DenseSparseMatrixSolver; // NOLINT
typedef TypedLinearSolver<TripletSparseMatrix> TripletSparseMatrixSolver; // NOLINT
using BlockSparseMatrixSolver = TypedLinearSolver<BlockSparseMatrix>; // NOLINT
using CompressedRowSparseMatrixSolver = TypedLinearSolver<CompressedRowSparseMatrix>; // NOLINT
using DenseSparseMatrixSolver = TypedLinearSolver<DenseSparseMatrix>; // NOLINT
using TripletSparseMatrixSolver = TypedLinearSolver<TripletSparseMatrix>; // NOLINT
// clang-format on
} // namespace ceres::internal
+1 -1
View File
@@ -274,7 +274,7 @@ class CERES_NO_EXPORT SuiteSparseCholesky final : public SparseCholesky {
#else // CERES_NO_SUITESPARSE
typedef void cholmod_factor;
using cholmod_factor = void;
#include "ceres/internal/disable_warnings.h"