mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Add ability to query available linear algebra backend.
Change-Id: Ide349a04a69b1a377ea789b355e00b210ec792ba
This commit is contained in:
@@ -324,7 +324,11 @@ const char* LinearSolverTerminationTypeToString(
|
||||
LinearSolverTerminationType type);
|
||||
|
||||
const char* SolverTerminationTypeToString(SolverTerminationType type);
|
||||
|
||||
bool IsSchurType(LinearSolverType type);
|
||||
bool IsSparseLinearAlgebraLibraryTypeAvailable(
|
||||
SparseLinearAlgebraLibraryType type);
|
||||
|
||||
|
||||
} // namespace ceres
|
||||
|
||||
|
||||
@@ -201,4 +201,26 @@ bool IsSchurType(LinearSolverType type) {
|
||||
(type == ITERATIVE_SCHUR));
|
||||
}
|
||||
|
||||
bool IsSparseLinearAlgebraLibraryTypeAvailable(
|
||||
SparseLinearAlgebraLibraryType type) {
|
||||
if (type == SUITE_SPARSE) {
|
||||
#ifdef CERES_NO_SUITESPARSE
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (type == CX_SPARSE) {
|
||||
#ifdef CERES_NO_CXSPARSE
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
LOG(WARNING) << "Unknown sparse linear algebra library " << type;
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ceres
|
||||
|
||||
Reference in New Issue
Block a user