diff options
Diffstat (limited to 'extern/libmv/third_party/ceres/internal/ceres/types.cc')
-rw-r--r-- | extern/libmv/third_party/ceres/internal/ceres/types.cc | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/extern/libmv/third_party/ceres/internal/ceres/types.cc b/extern/libmv/third_party/ceres/internal/ceres/types.cc index 2e19322cc76..a97f1a55e6b 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/types.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/types.cc @@ -101,7 +101,6 @@ const char* SparseLinearAlgebraLibraryTypeToString( } } - bool StringToSparseLinearAlgebraLibraryType( string value, SparseLinearAlgebraLibraryType* type) { @@ -111,6 +110,25 @@ bool StringToSparseLinearAlgebraLibraryType( return false; } +const char* DenseLinearAlgebraLibraryTypeToString( + DenseLinearAlgebraLibraryType type) { + switch (type) { + CASESTR(EIGEN); + CASESTR(LAPACK); + default: + return "UNKNOWN"; + } +} + +bool StringToDenseLinearAlgebraLibraryType( + string value, + DenseLinearAlgebraLibraryType* type) { + UpperCase(&value); + STRENUM(EIGEN); + STRENUM(LAPACK); + return false; +} + const char* TrustRegionStrategyTypeToString(TrustRegionStrategyType type) { switch (type) { CASESTR(LEVENBERG_MARQUARDT); @@ -165,6 +183,7 @@ const char* LineSearchDirectionTypeToString(LineSearchDirectionType type) { CASESTR(STEEPEST_DESCENT); CASESTR(NONLINEAR_CONJUGATE_GRADIENT); CASESTR(LBFGS); + CASESTR(BFGS); default: return "UNKNOWN"; } @@ -176,12 +195,14 @@ bool StringToLineSearchDirectionType(string value, STRENUM(STEEPEST_DESCENT); STRENUM(NONLINEAR_CONJUGATE_GRADIENT); STRENUM(LBFGS); + STRENUM(BFGS); return false; } const char* LineSearchTypeToString(LineSearchType type) { switch (type) { CASESTR(ARMIJO); + CASESTR(WOLFE); default: return "UNKNOWN"; } @@ -190,6 +211,28 @@ const char* LineSearchTypeToString(LineSearchType type) { bool StringToLineSearchType(string value, LineSearchType* type) { UpperCase(&value); STRENUM(ARMIJO); + STRENUM(WOLFE); + return false; +} + +const char* LineSearchInterpolationTypeToString( + LineSearchInterpolationType type) { + switch (type) { + CASESTR(BISECTION); + CASESTR(QUADRATIC); + CASESTR(CUBIC); + default: + return "UNKNOWN"; + } +} + +bool StringToLineSearchInterpolationType( + string value, + LineSearchInterpolationType* type) { + UpperCase(&value); + STRENUM(BISECTION); + STRENUM(QUADRATIC); + STRENUM(CUBIC); return false; } @@ -214,6 +257,27 @@ bool StringToNonlinearConjugateGradientType( return false; } +const char* CovarianceAlgorithmTypeToString( + CovarianceAlgorithmType type) { + switch (type) { + CASESTR(DENSE_SVD); + CASESTR(SPARSE_CHOLESKY); + CASESTR(SPARSE_QR); + default: + return "UNKNOWN"; + } +} + +bool StringToCovarianceAlgorithmType( + string value, + CovarianceAlgorithmType* type) { + UpperCase(&value); + STRENUM(DENSE_SVD); + STRENUM(SPARSE_CHOLESKY); + STRENUM(SPARSE_QR); + return false; +} + const char* SolverTerminationTypeToString(SolverTerminationType type) { switch (type) { CASESTR(NO_CONVERGENCE); @@ -272,4 +336,21 @@ bool IsSparseLinearAlgebraLibraryTypeAvailable( return false; } +bool IsDenseLinearAlgebraLibraryTypeAvailable( + DenseLinearAlgebraLibraryType type) { + if (type == EIGEN) { + return true; + } + if (type == LAPACK) { +#ifdef CERES_NO_LAPACK + return false; +#else + return true; +#endif + } + + LOG(WARNING) << "Unknown dense linear algebra library " << type; + return false; +} + } // namespace ceres |