diff --git a/Project.toml b/Project.toml index 4f381bb..de77830 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SparseArraysBase" uuid = "0d5efcca-f356-4864-8770-e1ed8d78f208" authors = ["ITensor developers and contributors"] -version = "0.2.4" +version = "0.2.5" [deps] Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" diff --git a/src/abstractsparsearray.jl b/src/abstractsparsearray.jl index b29640a..14e01d1 100644 --- a/src/abstractsparsearray.jl +++ b/src/abstractsparsearray.jl @@ -51,4 +51,5 @@ end function getunstoredindex(a::ReplacedUnstoredSparseArray, I::Int...) return a.getunstoredindex(a, I...) end +eachstoredindex(a::ReplacedUnstoredSparseArray) = eachstoredindex(parent(a)) @derive ReplacedUnstoredSparseArray AbstractArrayOps diff --git a/src/abstractsparsearrayinterface.jl b/src/abstractsparsearrayinterface.jl index cf7ca79..65937f3 100644 --- a/src/abstractsparsearrayinterface.jl +++ b/src/abstractsparsearrayinterface.jl @@ -388,7 +388,7 @@ end Base.show(io::IO, c::UnquotedChar) = print(io, c.char) Base.show(io::IO, ::MIME"text/plain", c::UnquotedChar) = show(io, c) -function show_getunstoredindex(a::AbstractArray, I::Int...) +function getunstoredindex_show(a::AbstractArray, I::Int...) return UnquotedChar('⋅') end @@ -399,7 +399,7 @@ end isempty(a) && return nothing print(io, ":") println(io) - a′ = ReplacedUnstoredSparseArray(a, show_getunstoredindex) + a′ = ReplacedUnstoredSparseArray(a, getunstoredindex_show) Base.print_array(io, a′) return nothing end diff --git a/test/basics/test_sparsearraydok.jl b/test/basics/test_sparsearraydok.jl index 552fd0a..642f8c9 100644 --- a/test/basics/test_sparsearraydok.jl +++ b/test/basics/test_sparsearraydok.jl @@ -169,10 +169,12 @@ arrayts = (Array,) @test b[1, 2] == 12 @test b[4, 3] == 21 - # Printing - # Not testing other element types since they change the - # spacing so it isn't easy to make the test general. - a = SparseArrayDOK{Float64}(2, 2) - a[1, 2] = 12 - @test sprint(show, "text/plain", a) == "$(summary(a)):\n ⋅ $(eltype(a)(12))\n ⋅ ⋅" + if elt === Float64 + # Printing + # Not testing other element types since they change the + # spacing so it isn't easy to make the test general. + a = SparseArrayDOK{elt}(2, 2) + a[1, 2] = 12 + @test sprint(show, "text/plain", a) == "$(summary(a)):\n ⋅ $(eltype(a)(12))\n ⋅ ⋅" + end end