mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Default to any other sparse libraries over Accelerate
- Accelerate currently does not support dynamic sparsity, whereas the other sparse linear algebra libraries do (outstanding issue to update) - Previously we preferred Accelerate to all but SuiteSparse if it was available, which breaks the dynamic_sparsity_test if SuiteSparse is *not* available (even if others are) as Accelerate does not support dynamic sparsity. Change-Id: Ibc2dd2f14f83cffbecca38097d02bb2188aaaa05
This commit is contained in:
@@ -358,12 +358,12 @@ class CERES_EXPORT Solver {
|
||||
SparseLinearAlgebraLibraryType sparse_linear_algebra_library_type =
|
||||
#if !defined(CERES_NO_SUITESPARSE)
|
||||
SUITE_SPARSE;
|
||||
#elif !defined(CERES_NO_ACCELERATE_SPARSE)
|
||||
ACCELERATE_SPARSE;
|
||||
#elif !defined(CERES_NO_CXSPARSE)
|
||||
CX_SPARSE;
|
||||
#elif defined(CERES_USE_EIGEN_SPARSE)
|
||||
EIGEN_SPARSE;
|
||||
#elif !defined(CERES_NO_CXSPARSE)
|
||||
CX_SPARSE;
|
||||
#elif !defined(CERES_NO_ACCELERATE_SPARSE)
|
||||
ACCELERATE_SPARSE;
|
||||
#else
|
||||
NO_SPARSE;
|
||||
#endif
|
||||
|
||||
@@ -92,8 +92,10 @@ LinearSolver::Summary DynamicSparseNormalCholeskySolver::SolveImpl(
|
||||
summary = SolveImplUsingEigen(A, x);
|
||||
break;
|
||||
default:
|
||||
LOG(FATAL) << "Unknown sparse linear algebra library : "
|
||||
<< options_.sparse_linear_algebra_library_type;
|
||||
LOG(FATAL) << "Unsupported sparse linear algebra library for "
|
||||
<< "dynamic sparsity: "
|
||||
<< SparseLinearAlgebraLibraryTypeToString(
|
||||
options_.sparse_linear_algebra_library_type);
|
||||
}
|
||||
|
||||
if (per_solve_options.D != nullptr) {
|
||||
|
||||
@@ -222,10 +222,16 @@ bool TrustRegionOptionsAreValid(const Solver::Options& options, string* error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (options.dynamic_sparsity &&
|
||||
options.linear_solver_type != SPARSE_NORMAL_CHOLESKY) {
|
||||
*error = "Dynamic sparsity is only supported with SPARSE_NORMAL_CHOLESKY.";
|
||||
return false;
|
||||
if (options.dynamic_sparsity) {
|
||||
if (options.linear_solver_type != SPARSE_NORMAL_CHOLESKY) {
|
||||
*error = "Dynamic sparsity is only supported with SPARSE_NORMAL_CHOLESKY.";
|
||||
return false;
|
||||
}
|
||||
if (options.sparse_linear_algebra_library_type == ACCELERATE_SPARSE) {
|
||||
*error = "ACCELERATE_SPARSE is not currently supported with dynamic "
|
||||
"sparsity.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -336,6 +336,15 @@ TEST(Solver, SparseSchurNoAccelerateSparse) {
|
||||
string message;
|
||||
EXPECT_FALSE(options.IsValid(&message));
|
||||
}
|
||||
#else
|
||||
TEST(Solver, DynamicSparseNormalCholeskyUnsupportedWithAccelerateSparse) {
|
||||
Solver::Options options;
|
||||
options.sparse_linear_algebra_library_type = ACCELERATE_SPARSE;
|
||||
options.linear_solver_type = SPARSE_NORMAL_CHOLESKY;
|
||||
options.dynamic_sparsity = true;
|
||||
string message;
|
||||
EXPECT_FALSE(options.IsValid(&message));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CERES_USE_EIGEN_SPARSE)
|
||||
|
||||
Reference in New Issue
Block a user