Skip to content

Commit 1c044fb

Browse files
Merge pull request #580 from SciML/ChrisRackauckas-patch-2
Better handle Sparspak not loaded by default
2 parents 6202615 + 5a0bf4d commit 1c044fb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ext/LinearSolveSparseArraysExt.jl

+8-3
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ end
4545

4646
function LinearSolve.defaultalg(A::AbstractSparseMatrixCSC{Tv, Ti}, b,
4747
assump::OperatorAssumptions{Bool}) where {Tv, Ti}
48-
if assump.issq
49-
DefaultLinearSolver(DefaultAlgorithmChoice.SparspakFactorization)
50-
else
48+
ext = Base.get_extension(LinearSolve, :LinearSolveSparspakExt)
49+
if assump.issq && ext !== nothing
50+
LinearSolve.DefaultLinearSolver(DefaultAlgorithmChoice.SparspakFactorization)
51+
elseif !assump.issq
5152
error("Generic number sparse factorization for non-square is not currently handled")
53+
elseif ext === nothing
54+
error("SparspakFactorization required for general sparse matrix types and with general Julia number types. Do `using Sparspak` in order to enable this functionality")
55+
else
56+
error("Unreachable reached. Please report this error with a reproducer."
5257
end
5358
end
5459

0 commit comments

Comments
 (0)