Skip to content

Commit e73ca6b

Browse files
committed
Fix ismutable for sparse arrays
1 parent 88bbbfb commit e73ca6b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/ArrayInterface.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Base.@pure ismutable(x::DataType) = x.mutable
1616
ismutable(x) = ismutable(typeof(x))
1717

1818
ismutable(::Type{<:Array}) = true
19+
ismutable(::Type{<:SparseMatrixCSC}) = true
20+
ismutable(::Type{<:SparseVector}) = true
1921
ismutable(::Type{<:Number}) = false
2022

2123
# Piracy

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ Sp=sparse([1,2,3],[1,2,3],[1,2,3])
3939
rowind,colind=findstructralnz(Sp)
4040
@test [Tri[rowind[i],colind[i]] for i in 1:length(rowind)]==[1,2,3]
4141

42+
@test ArrayInterface.ismutable(spzeros(1, 1))
43+
@test ArrayInterface.ismutable(spzeros(1))
44+
4245
@test !fast_scalar_indexing(qr(rand(10, 10)).Q)
4346
@test !fast_scalar_indexing(qr(rand(10, 10), Val(true)).Q)
4447
@test !fast_scalar_indexing(lq(rand(10, 10)).Q)

0 commit comments

Comments
 (0)