# Sparse arrays "\\"

**URL:** <https://discourse.julialang.org/t/sparse-arrays/30606>\
**Category:** Numerics\
**Created:** [November 1, 2019, 8:20pm UTC](https://discourse.julialang.org/t/sparse-arrays/30606 "2019-11-01T20:20:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuhaHeiskala](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@JuhaHeiskala](https://discourse.julialang.org/u/JuhaHeiskala)\
**Post date:** [November 1, 2019, 8:20pm UTC](https://discourse.julialang.org/t/sparse-arrays/30606/1 "2019-11-01T20:20:48Z")

</div>

Apparently “A\b” is not fully supported for both A and b being sparse arrays.  
using SparseArrays  
A=sprand(10,10,0.4)  
b=sprand(10,10,0.3)  
A\b  
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

A\Array(b)  
julia\> A\Array(b)  
10×1 Array{Float64,2}:  
-2.975057686758748  
1.4647987429262779  
0.5383182428619319  
-0.8475332612566527  
-0.8920771064715199  
0.139199739907848  
1.198495620310481  
-0.733125055450034  
-0.2269834237581322  
0.3880953759457807

---

<div class="post-metadata">

**Author:** ![Pbellive](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbellive/32/3604_2.png) [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Post date:** [November 1, 2019, 11:47pm UTC](https://discourse.julialang.org/t/sparse-arrays/30606/2 "2019-11-01T23:47:39Z")

</div>

This is the intended behaviour. See the following issue on Github:  
[https://github.com/JuliaLang/julia/issues/33637](https://github.com/JuliaLang/julia/issues/33637)  
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](http://mumps.enseeiht.fr/) sparse direct solver does support sparse right hand sides. The main [julia interface to MUMPS](https://github.com/JuliaSmoothOptimizers/MUMPS.jl) does not expose that support unfortunately. There is an [alternative julia MUMPS interface](https://github.com/JuliaInv/MUMPSjInv.jl) that does support sparse right hand sides but overall it’s not as full featured an interface as the main one.

---

<div class="post-metadata">

**Author:** ![JuhaHeiskala](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@JuhaHeiskala](https://discourse.julialang.org/u/JuhaHeiskala)\
**Post date:** [November 2, 2019, 9:00am UTC](https://discourse.julialang.org/t/sparse-arrays/30606/3 "2019-11-02T09:00:44Z")

</div>

Ok, thanks for the reply.
