Skip to content

Commit 3c54b0e

Browse files
author
Wimmerer
committed
default to no reuse
1 parent 93dc27d commit 3c54b0e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/factorization.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ function init_cacheval(alg::LUFactorization, A, b, u)
3535
end
3636

3737
# This could be a GenericFactorization perhaps?
38-
struct UMFPACKFactorization <: AbstractFactorization
38+
Base.@kwdef struct UMFPACKFactorization <: AbstractFactorization
39+
reuse_symbolic::Bool = false
3940
end
4041

4142
function init_cacheval(::UMFPACKFactorization, A, b, u)
@@ -55,7 +56,7 @@ function SciMLBase.solve(cache::LinearCache, alg::UMFPACKFactorization)
5556
A = A.A
5657
end
5758
if cache.isfresh
58-
if cache.cacheval !== nothing
59+
if cache.cacheval !== nothing && alg.reuse_symbolic
5960
# If we have a cacheval already, run umfpack_symbolic to ensure the symbolic factorization exists
6061
# This won't recompute if it does.
6162
SuiteSparse.UMFPACK.umfpack_symbolic!(cache.cacheval)

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ end
7474
test_interface(UMFPACKFactorization(), prob1, prob2)
7575

7676
# Test that refactoring wrong throws.
77-
cache = SciMLBase.init(prob1,UMFPACKFactorization(); cache_kwargs...) # initialize cache
77+
cache = SciMLBase.init(prob1,UMFPACKFactorization(reuse_symbolic=true); cache_kwargs...) # initialize cache
7878
y = solve(cache)
7979
cache = LinearSolve.set_A(cache,sprand(n, n, 0.8))
8080
@test_throws ArgumentError solve(cache)

0 commit comments

Comments
 (0)