diff --git a/src/ArrayInterface.jl b/src/ArrayInterface.jl index 5f07f6da3..40d52db18 100644 --- a/src/ArrayInterface.jl +++ b/src/ArrayInterface.jl @@ -16,6 +16,8 @@ Base.@pure ismutable(x::DataType) = x.mutable ismutable(x) = ismutable(typeof(x)) ismutable(::Type{<:Array}) = true +ismutable(::Type{<:SparseMatrixCSC}) = true +ismutable(::Type{<:SparseVector}) = true ismutable(::Type{<:Number}) = false # Piracy diff --git a/test/runtests.jl b/test/runtests.jl index c77bf0527..c7ede7eb8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -39,6 +39,9 @@ Sp=sparse([1,2,3],[1,2,3],[1,2,3]) rowind,colind=findstructralnz(Sp) @test [Tri[rowind[i],colind[i]] for i in 1:length(rowind)]==[1,2,3] +@test ArrayInterface.ismutable(spzeros(1, 1)) +@test ArrayInterface.ismutable(spzeros(1)) + @test !fast_scalar_indexing(qr(rand(10, 10)).Q) @test !fast_scalar_indexing(qr(rand(10, 10), Val(true)).Q) @test !fast_scalar_indexing(lq(rand(10, 10)).Q)