Open ytdHuang opened 2 years ago
@Wimmerer what happened to all of the ldiv!
methods?
I just find out that for KLU
and UmfpackLU
, they only allow b::Vector{T} where T == eltype(A)
.
They don't allow b
to be SparseVector
That is, the following code works:
julia > using SparseArrays, LinearSolve
julia > A = sprand(10, 10, 0.5)
julia > b = rand(10) # sprand is not available
julia > sol = solve(LinearProblem(A , b))
Does anyone have any idea how to solve this problem without converting the type of b
from SparseVector
to Vector
?
Because I am dealing with the case that dimension of the Matrix is quite large (>=10,000,000
).
Or should I just convert b
to dense Vector everytime ?
Or should I just convert b to dense Vector everytime ?
This is usually what is done. The solution will be dense anyway, most likely.
I don't believe KLU supports sparse RHS. Let me look if we have solvers that do @ChrisRackauckas
Oh, I didn't see the sparse vector part. Yeah, the solution is dense anyways so the conversion would be best. It might be good to just do that automatically?
I can do that, we do a copy anyway, so I'll try to be sure we don't copy twice.
Hi,
I have some issues when dealing with sparse-type matrices (from package
SparseArrays
)When I entered the following command, it caused an error:
I've looked into the definition of ldiv! in KLU source file. The method
ldiv!(::KLU.KLUFactorization{Float64, Int64}, ::SparseVector{Float64, Int64})
seems not matchingldiv!(klu::AbstractKLUFactorization{Tv}, B::StridedVecOrMat{Tv}) where {Tv<: Union{Float64, ComplexF64}}
I also tried:
Still not working, did I miss anything? Or should I solve sparse-type problems in different ways with
LinearSolve
(for example: passing custom solver in the documentation)?Because the case I am dealing with is to solve many large sparse matrices
A
(the elements are all in typeComplexF64
but allA
have the same sparse pattern) andb
is always fixed, I really need this package.All of my package versions are listed below