-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
Hi there,
I was working with a linear system defined by an ExtendableSparseMatrix, which I wanted to solve using LinearSolve.jl. However, when I tried to solve the system using the cache, I received the following error. The code and error message are documented below.
Note that using linsolve = init(prob)
or linsolve = init(prob, UMFPACKFactorization())
runs successfully.
function minimal_example(N; usecache=true)
b = zeros(N)
A = ExtendableSparseMatrix(N,N)
for i in 1:N
A[i,i] = 1
end
flush!(A)
prob = LinearProblem(A, b)
if usecache
linsolve = LinearSolve.init(prob, KLUFactorization())
LinearSolve.solve!(linsolve)
else
LinearSolve.solve(prob)
end
return "success return"
end;
Resulting error when using usecache=true
:
ERROR: DimensionMismatch:
Stacktrace:
[1] klu!(K::LinearSolveSparseArraysExt.KLU.KLUFactorization{…}, nzval::Vector{…}; check::Bool, allowsingular::Bool)
@ LinearSolveSparseArraysExt.KLU C:\Users\marie\.julia\packages\LinearSolve\wrTJy\src\KLU\klu.jl:640
[2] klu!
@ C:\Users\marie\.julia\packages\LinearSolve\wrTJy\src\KLU\klu.jl:638 [inlined]
[3] solve!(cache::LinearSolve.LinearCache{…}, alg::KLUFactorization; kwargs::@Kwargs{})
@ LinearSolveSparseArraysExt C:\Users\marie\.julia\packages\LinearSolve\wrTJy\ext\LinearSolveSparseArraysExt.jl:247
[4] solve!
@ C:\Users\marie\.julia\packages\LinearSolve\wrTJy\ext\LinearSolveSparseArraysExt.jl:235 [inlined]
[5] #solve!#11
@ C:\Users\marie\.julia\packages\LinearSolve\wrTJy\src\common.jl:299 [inlined]
[6] solve!(::LinearSolve.LinearCache{…})
@ LinearSolve C:\Users\marie\.julia\packages\LinearSolve\wrTJy\src\common.jl:298
[7] minimal_example(N::Int64; usecache::Bool)
@ Main c:\Users\marie\Desktop\WIAS\04_Minimal-working-examples\Minimal-working-example_Compatibility-ExtendableSparse-LinearSolve.jl:20
[8] top-level scope
@ c:\Users\marie\Desktop\WIAS\04_Minimal-working-examples\Minimal-working-example_Compatibility-ExtendableSparse-LinearSolve.jl:30
Some type information was truncated. Use `show(err)` to see complete types
Metadata
Metadata
Assignees
Labels
No labels