Skip to content

Commit be89d6f

Browse files
Throw proper error for Sparspak missing
Fixes #578 (comment)
1 parent dbe004f commit be89d6f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/factorization.jl

+11-2
Original file line numberDiff line numberDiff line change
@@ -1044,8 +1044,17 @@ dispatch to route around standard BLAS routines in the case e.g. of arbitrary-pr
10441044
floating point numbers or ForwardDiff.Dual.
10451045
This e.g. allows for Automatic Differentiation (AD) of a sparse-matrix solve.
10461046
"""
1047-
Base.@kwdef struct SparspakFactorization <: AbstractSparseFactorization
1048-
reuse_symbolic::Bool = true
1047+
struct SparspakFactorization <: AbstractSparseFactorization
1048+
reuse_symbolic::Bool
1049+
1050+
function SparspakFactorization(;reuse_symbolic = true)
1051+
ext = Base.get_extension(@__MODULE__, :LinearSolveSparspakExt)
1052+
if ext === nothing
1053+
error("SparspakFactorization requires that Sparspak is loaded, i.e. `using Sparspak`")
1054+
else
1055+
new(reuse_symbolic)
1056+
end
1057+
end
10491058
end
10501059

10511060
function init_cacheval(alg::SparspakFactorization,

0 commit comments

Comments
 (0)