ERROR: MethodError: no method matching lu!

I am not an expert on using LinearAlgebra together with sparse matrices, but the problem is the combination of type SparseMatrixCSC together with the @view. The following two versions work and produce the same result:

julia> x = A[p,q][1:6,1:6] \ b[p[1:6]]  #removing the @view
6-element Vector{Float64}:
   128.2117919309576
   -16.895499498950457
  -111.31629243200855
 -3853.923847656095
   999.3164345402253
  2854.6074131158075

julia> x = Matrix(A[p,q][1:6,1:6]) \ @view( b[p[1:6]] ) #removing the sparseness
6-element Vector{Float64}:
   128.21179193095756
   -16.895499498950315
  -111.31629243200855
 -3853.9238476560936
   999.3164345402255
  2854.6074131158075

But you probably did this by purpose to reduce allocations and have better performance. And this is where I am out and we need someone else to give proper advice.

Maybe it’s something suitable for an issue at LinearAlgebra.jl (julia/LinearAlgebra.jl at master · JuliaLang/julia · GitHub) . A short search didn’t brought something obvious up.

1 Like