mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Do not create a SparseCholesky object when not needed.
SchurComplementSolver implements a variant of ITERATIVE_SCHUR when explicit_schur_complement is set to true. In this case the SparseCholesky object should not be instantiated. Even though there is no CPU cost, it can be the case that ITERATIVE_SCHUR is being used when there are not sparse linear algebra libraries are available, and this can result in a crash. Change-Id: I349d5f79201782689b3ab0ccc2c5001804b44c7b
This commit is contained in:
@@ -226,9 +226,11 @@ DenseSchurComplementSolver::SolveReducedLinearSystem(
|
||||
SparseSchurComplementSolver::SparseSchurComplementSolver(
|
||||
const LinearSolver::Options& options)
|
||||
: SchurComplementSolver(options) {
|
||||
sparse_cholesky_.reset(
|
||||
SparseCholesky::Create(options.sparse_linear_algebra_library_type,
|
||||
options.use_postordering ? AMD : NATURAL));
|
||||
if (options.type != ITERATIVE_SCHUR) {
|
||||
sparse_cholesky_.reset(
|
||||
SparseCholesky::Create(options.sparse_linear_algebra_library_type,
|
||||
options.use_postordering ? AMD : NATURAL));
|
||||
}
|
||||
}
|
||||
|
||||
SparseSchurComplementSolver::~SparseSchurComplementSolver() {
|
||||
|
||||
Reference in New Issue
Block a user