Skip to content

Commit c57ee97

Browse files
Set a sparsity threshold for KLU
Closes #340. While many results are very much based on more details about the sparsity pattern, it's at least clear that if the matrix is not very sparse then it should probably use UMFPACK, so this is a conservative bound. When mixed with the length bound, I find that this seems to work rather well, though is not always optimal, is at least better than always choosing UMFPACK
1 parent 61f4dc3 commit c57ee97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/default.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ end
7979
function defaultalg(A::AbstractSparseMatrixCSC{<:Union{Float64, ComplexF64}, Ti}, b,
8080
assump::OperatorAssumptions) where {Ti}
8181
if assump.issq
82-
if length(b) <= 10_000
82+
if length(b) <= 10_000 && length(nonzeros(A)) / length(A) < 1e-4
8383
DefaultLinearSolver(DefaultAlgorithmChoice.KLUFactorization)
8484
else
8585
DefaultLinearSolver(DefaultAlgorithmChoice.UMFPACKFactorization)

0 commit comments

Comments
 (0)