Skip to content

Commit bd01c98

Browse files
Merge pull request #172 from SciML/klu
Fix and test KLU slow branch
2 parents bb1f9f4 + bf48b97 commit bd01c98

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/factorization.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ function SciMLBase.solve(cache::LinearCache, alg::KLUFactorization; kwargs...)
299299
end
300300
fact = KLU.klu!(cache.cacheval, A)
301301
else
302-
fact = do_factorization(alg, A, cache.b, cache.u)
302+
# New fact each time since the sparsity pattern can change
303+
# and thus it needs to reallocate
304+
fact = KLU.klu(A)
303305
end
304306
cache = set_cacheval(cache, fact)
305307
end

test/basictests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ end
108108
prob1 = LinearProblem(sparse(A1), b1; u0 = x1)
109109
prob2 = LinearProblem(sparse(A2), b2; u0 = x2)
110110
test_interface(KLUFactorization(), prob1, prob2)
111+
test_interface(KLUFactorization(reuse_symbolic = false), prob1, prob2)
111112

112113
# Test that refactoring wrong throws.
113114
cache = SciMLBase.init(prob1, KLUFactorization(); cache_kwargs...) # initialize cache

0 commit comments

Comments
 (0)