Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Some reshapes of subarrays are strided, but `StrideIndex` fails.

Open
#10 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia
Domain
performance

Research direction

Reproduce the two Julia examples, then inspect src/array_index.jl around lines 197-203 where StrideIndex fails. Trace dense_dims(view(A,ix,:,:)) and the collapsed-dimension handling; done is that both StrideIndex calls work and dense_dims reports (static(false), static(false)) as described.

Written by the indexing model from the issue text.

Description

julia> ix = 2;

julia> A = rand(7, 5, 6);

julia> src = view(view(A,ix, :, :),:);

julia> ArrayInterface.StrideIndex(src)
ERROR: TypeError: in typeassert, expected Tuple{Int64}, got a value of type Nothing
Stacktrace:
 [1] (ArrayInterface.StrideIndex{1, nothing, nothing})(s::Tuple{StaticInt{1}}, o::Tuple{StaticInt{1}})
   @ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:197
 [2] (ArrayInterface.StrideIndex{1, nothing, nothing})(a::SubArray{Float64, 1, Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true})
   @ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:200
 [3] ArrayInterface.StrideIndex(a::SubArray{Float64, 1, Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true})
   @ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:203
 [4] top-level scope
   @ REPL[25]:1

julia> ArrayInterface.StrideIndex(vec(view(A,ix,:,:)))
ERROR: TypeError: in typeassert, expected Tuple{Int64}, got a value of type Nothing
Stacktrace:
 [1] (ArrayInterface.StrideIndex{1, nothing, nothing})(s::Tuple{StaticInt{1}}, o::Tuple{StaticInt{1}})
   @ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:197
 [2] (ArrayInterface.StrideIndex{1, nothing, nothing})(a::Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}})
   @ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:200
 [3] ArrayInterface.StrideIndex(a::Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}})
   @ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:203
 [4] top-level scope
   @ REPL[26]:1

Basically, if collapsed dims are dense with respect to one another, collapsing them presevers strided-ness.

We should also redefine dense dims as necessary to be a statement only about that dim.

julia> ArrayInterface.dense_dims(view(A,ix,:,:))
(static(false), static(false))

So that the first dim is not dense, but the second one still is w/ respect to the first.

Dominant language
Julia
Stars
14
Forks
8
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JuliaArrays/StaticArrayInterface.jl

All issues in JuliaArrays/StaticArrayInterface.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.