diff options
Diffstat (limited to 'extern/ceres/internal/ceres/types.cc')
-rw-r--r-- | extern/ceres/internal/ceres/types.cc | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/extern/ceres/internal/ceres/types.cc b/extern/ceres/internal/ceres/types.cc index 93c4cfcb027..39bb2d8cc4d 100644 --- a/extern/ceres/internal/ceres/types.cc +++ b/extern/ceres/internal/ceres/types.cc @@ -28,18 +28,22 @@ // // Author: sameeragarwal@google.com (Sameer Agarwal) +#include "ceres/types.h" + #include <algorithm> #include <cctype> #include <string> -#include "ceres/types.h" + #include "glog/logging.h" namespace ceres { using std::string; +// clang-format off #define CASESTR(x) case x: return #x -#define STRENUM(x) if (value == #x) { *type = x; return true;} +#define STRENUM(x) if (value == #x) { *type = x; return true; } +// clang-format on static void UpperCase(string* input) { std::transform(input->begin(), input->end(), input->begin(), ::toupper); @@ -109,8 +113,7 @@ const char* SparseLinearAlgebraLibraryTypeToString( } bool StringToSparseLinearAlgebraLibraryType( - string value, - SparseLinearAlgebraLibraryType* type) { + string value, SparseLinearAlgebraLibraryType* type) { UpperCase(&value); STRENUM(SUITE_SPARSE); STRENUM(CX_SPARSE); @@ -131,8 +134,7 @@ const char* DenseLinearAlgebraLibraryTypeToString( } bool StringToDenseLinearAlgebraLibraryType( - string value, - DenseLinearAlgebraLibraryType* type) { + string value, DenseLinearAlgebraLibraryType* type) { UpperCase(&value); STRENUM(EIGEN); STRENUM(LAPACK); @@ -236,9 +238,8 @@ const char* LineSearchInterpolationTypeToString( } } -bool StringToLineSearchInterpolationType( - string value, - LineSearchInterpolationType* type) { +bool StringToLineSearchInterpolationType(string value, + LineSearchInterpolationType* type) { UpperCase(&value); STRENUM(BISECTION); STRENUM(QUADRATIC); @@ -258,8 +259,7 @@ const char* NonlinearConjugateGradientTypeToString( } bool StringToNonlinearConjugateGradientType( - string value, - NonlinearConjugateGradientType* type) { + string value, NonlinearConjugateGradientType* type) { UpperCase(&value); STRENUM(FLETCHER_REEVES); STRENUM(POLAK_RIBIERE); @@ -267,8 +267,7 @@ bool StringToNonlinearConjugateGradientType( return false; } -const char* CovarianceAlgorithmTypeToString( - CovarianceAlgorithmType type) { +const char* CovarianceAlgorithmTypeToString(CovarianceAlgorithmType type) { switch (type) { CASESTR(DENSE_SVD); CASESTR(SPARSE_QR); @@ -277,17 +276,15 @@ const char* CovarianceAlgorithmTypeToString( } } -bool StringToCovarianceAlgorithmType( - string value, - CovarianceAlgorithmType* type) { +bool StringToCovarianceAlgorithmType(string value, + CovarianceAlgorithmType* type) { UpperCase(&value); STRENUM(DENSE_SVD); STRENUM(SPARSE_QR); return false; } -const char* NumericDiffMethodTypeToString( - NumericDiffMethodType type) { +const char* NumericDiffMethodTypeToString(NumericDiffMethodType type) { switch (type) { CASESTR(CENTRAL); CASESTR(FORWARD); @@ -297,9 +294,7 @@ const char* NumericDiffMethodTypeToString( } } -bool StringToNumericDiffMethodType( - string value, - NumericDiffMethodType* type) { +bool StringToNumericDiffMethodType(string value, NumericDiffMethodType* type) { UpperCase(&value); STRENUM(CENTRAL); STRENUM(FORWARD); @@ -307,8 +302,7 @@ bool StringToNumericDiffMethodType( return false; } -const char* VisibilityClusteringTypeToString( - VisibilityClusteringType type) { +const char* VisibilityClusteringTypeToString(VisibilityClusteringType type) { switch (type) { CASESTR(CANONICAL_VIEWS); CASESTR(SINGLE_LINKAGE); @@ -317,9 +311,8 @@ const char* VisibilityClusteringTypeToString( } } -bool StringToVisibilityClusteringType( - string value, - VisibilityClusteringType* type) { +bool StringToVisibilityClusteringType(string value, + VisibilityClusteringType* type) { UpperCase(&value); STRENUM(CANONICAL_VIEWS); STRENUM(SINGLE_LINKAGE); @@ -354,9 +347,8 @@ bool StringtoLoggingType(std::string value, LoggingType* type) { return false; } - const char* DumpFormatTypeToString(DumpFormatType type) { - switch (type) { + switch (type) { CASESTR(CONSOLE); CASESTR(TEXTFILE); default: @@ -375,9 +367,11 @@ bool StringtoDumpFormatType(std::string value, DumpFormatType* type) { #undef STRENUM bool IsSchurType(LinearSolverType type) { + // clang-format off return ((type == SPARSE_SCHUR) || (type == DENSE_SCHUR) || (type == ITERATIVE_SCHUR)); + // clang-format on } bool IsSparseLinearAlgebraLibraryTypeAvailable( |