Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/solvers/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ function lu!(F::UmfpackLU{Tv, Ti}, S::AbstractSparseMatrixCSC;
return lu!(F; reuse_symbolic, check, q)
end

function lu!(F::UmfpackLU; check::Bool=true, reuse_symbolic::Bool=true, q=nothing)
function lu!(F::UmfpackLU{Tv, Ti}; check::Bool=true, reuse_symbolic::Bool=true,
q=nothing) where {Tv, Ti}
if !reuse_symbolic && _isnotnull(F.symbolic)
F.symbolic = Symbolic{Tv, Ti}(C_NULL)
end
Expand Down
16 changes: 11 additions & 5 deletions test/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ end
umfpack_report(x.b)
end

@testset "Reuse symbolic LU factorization" begin
@testset "Do/do not reuse symbolic LU factorization" for reuse ∈ (true, false)
A1 = sparse(increment!([0,4,1,1,2,2,0,1,2,3,4,4]),
increment!([0,4,0,2,1,2,1,4,3,2,1,2]),
[2.,1.,3.,4.,-1.,-3.,3.,9.,2.,1.,4.,2.], 5, 5)
Expand All @@ -420,7 +420,7 @@ end
b = Tv[8., 45., -3., 3., 19.]
F = lu(A)
umfpack_report(F)
lu!(F, B)
lu!(F, B; reuse_symbolic=reuse)
umfpack_report(F)
@test F\b ≈ B\b ≈ Matrix(B)\b

Expand All @@ -429,14 +429,20 @@ end
C[4, 3] = Tv(0)
F = lu(A)
umfpack_report(F)
@test_throws SingularException lu!(F, C)
@test_throws SingularException lu!(F, C; reuse_symbolic=reuse)
# change of nonzero pattern
D = copy(B)
D[5, 1] = Tv(1.0)
F = lu(A)
umfpack_report(F)
@test_throws ArgumentError lu!(F, D)
umfpack_report(F)
if reuse
@test_throws ArgumentError lu!(F, D; reuse_symbolic=reuse)
umfpack_report(F)
else
lu!(F, D; reuse_symbolic=reuse)
umfpack_report(F)
@test F\b ≈ D\b ≈ Matrix(D)\b
end
end
end
end
Expand Down
Loading