@@ -33,7 +33,11 @@ function defaultalg(A, b)
3333 elseif A isa SymTridiagonal
3434 alg = GenericFactorization (; fact_alg = ldlt!)
3535 elseif A isa SparseMatrixCSC
36- alg = KLUFactorization ()
36+ if length (b) <= 10_000
37+ alg = KLUFactorization ()
38+ else
39+ alg = UMFPACKFactorization ()
40+ end
3741
3842 # This catches the cases where a factorization overload could exist
3943 # For example, BlockBandedMatrix
@@ -96,8 +100,14 @@ function SciMLBase.solve(cache::LinearCache, alg::Nothing,
96100 alg = GenericFactorization (; fact_alg = ldlt!)
97101 SciMLBase. solve (cache, alg, args... ; kwargs... )
98102 elseif A isa SparseMatrixCSC
99- alg = KLUFactorization ()
100- SciMLBase. solve (cache, alg, args... ; kwargs... )
103+ b = cache. b
104+ if length (b) <= 10_000
105+ alg = KLUFactorization ()
106+ SciMLBase. solve (cache, alg, args... ; kwargs... )
107+ else
108+ alg = UMFPACKFactorization ()
109+ SciMLBase. solve (cache, alg, args... ; kwargs... )
110+ end
101111
102112 # This catches the cases where a factorization overload could exist
103113 # For example, BlockBandedMatrix
@@ -158,8 +168,13 @@ function init_cacheval(alg::Nothing, A, b, u, Pl, Pr, maxiters, abstol, reltol,
158168 alg = GenericFactorization (; fact_alg = ldlt!)
159169 init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
160170 elseif A isa SparseMatrixCSC
161- alg = KLUFactorization ()
162- init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
171+ if length (b) <= 10_000
172+ alg = KLUFactorization ()
173+ init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
174+ else
175+ alg = UMFPACKFactorization ()
176+ init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
177+ end
163178
164179 # This catches the cases where a factorization overload could exist
165180 # For example, BlockBandedMatrix
0 commit comments