Sparse arrays "\"

Apparently “A\b” is not fully supported for both A and b being sparse arrays.
using SparseArrays
ERROR: MethodError: no method matching ldiv!(::SuiteSparse.UMFPACK.UmfpackLU{Float64,Int64}, ::SparseMatrixCSC{Float64,Int64})
Closest candidates are:
ldiv!(::Number, ::AbstractArray) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\LinearAlgebra\src\generic.jl:152
ldiv!(::LinearAlgebra.LU{T,LinearAlgebra.Tridiagonal{T,V}}, ::Union{AbstractArray{T,2}, AbstractArray{T,1}} where T) where {T, V} at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\LinearAlgebra\src\lu.jl:523

julia> A\Array(b)
10×1 Array{Float64,2}:

This is the intended behaviour. See the following issue on Github:

The underlying library (Suitesparse) julia uses for factorization of sparse matrices and the direct solution of sparse linear systems does not support sparse right hand sides. If the right hand side b has many columns then converting this to a dense array can cause unacceptably high memory use, so I don’t think it’s a good idea to have the backslash operator do that automatically under the hood.

It might still be good to post an issue asking for a more useful error message in this case. It would be nice if you got a message that said something like “sparse right hand sides not supported” or something like that, rather than the method error.

As a side note, the MUMPS sparse direct solver does support sparse right hand sides. The main julia interface to MUMPS does not expose that support unfortunately. There is an alternative julia MUMPS interface that does support sparse right hand sides but overall it’s not as full featured an interface as the main one.


Ok, thanks for the reply.