Skip to content

[BUG] display(view(::BlockSparseArray)) errors for full view #78

@ogauthe

Description

@ogauthe

As mentioned in #73

bsa = BlockSparseArray{Float64}(undef,[2,2],[1,1])
display(view(bsa, :))  # ok
v = view(bsa, :, :);  # ok
display(v)  # MethodError
4×2 view(::BlockSparseMatrix{Float64, Matrix{Float64}, …, …}, :, :) with eltype Float64 with indices BlockedOneTo([2, 4])×BlockedOneTo([1, 2]):
ERROR: MethodError: no method matching Base.Slice(::Vector{Int64})
The type `Base.Slice` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  Base.Slice(::Base.Slice)
   @ Base indices.jl:385
  Base.Slice(::T) where T<:AbstractUnitRange
   @ Base indices.jl:383

Stacktrace:
  [1] adapt_structure(to::Type, r::Base.Slice{BlockedOneTo{Int64, Vector{Int64}}})
    @ Adapt ~/.julia/packages/Adapt/YR1WS/src/base.jl:82
  [2] adapt
    @ ~/.julia/packages/Adapt/YR1WS/src/Adapt.jl:40 [inlined]
  [3] _adapt_tuple_structure
    @ ~/.julia/packages/Adapt/YR1WS/src/base.jl:14 [inlined]
  [4] adapt_structure
    @ ~/.julia/packages/Adapt/YR1WS/src/base.jl:9 [inlined]
  [5] adapt
    @ ~/.julia/packages/Adapt/YR1WS/src/Adapt.jl:40 [inlined]
  [6] adapt_structure(to::Type, A::SubArray{Float64, 2, BlockSparseMatrix{…}, Tuple{…}, false})
    @ Adapt ~/.julia/packages/Adapt/YR1WS/src/wrappers.jl:10
  [7] adapt(to::Type, x::SubArray{Float64, 2, BlockSparseMatrix{…}, Tuple{…}, false})
    @ Adapt ~/.julia/packages/Adapt/YR1WS/src/Adapt.jl:40
  [8] print_array(io::IOContext{Base.TTY}, X::SubArray{Float64, 2, BlockSparseMatrix{…}, Tuple{…}, false})
    @ BlockSparseArrays ~/.julia/packages/BlockSparseArrays/1uOnj/src/abstractblocksparsearray/wrappedabstractblocksparsearray.jl:365
  [9] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, X::SubArray{Float64, 2, BlockSparseMatrix{…}, Tuple{…}, false})
    @ Base ./arrayshow.jl:399
 [10] (::OhMyREPL.var"#7#8"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::IOContext{Base.TTY})
    @ OhMyREPL ~/.julia/packages/OhMyREPL/bkUhZ/src/output_prompt_overwrite.jl:23
 [11] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-1.11.3+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:661
 [12] display
    @ ~/.julia/packages/OhMyREPL/bkUhZ/src/output_prompt_overwrite.jl:6 [inlined]
 [13] display
    @ ~/.julia/juliaup/julia-1.11.3+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:372 [inlined]
 [14] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:340
 [15] top-level scope
    @ REPL[6]:1
Some type information was truncated. Use `show(err)` to see complete types.

This is observed for any dimension.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions