Some reshapes of subarrays are strided, but `StrideIndex` fails.
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaArrays/StaticArrayInterface.jl
-
tagbot-manual
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Storage Order Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
JuliaArrays/StaticArrayInterface.jl#4 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
JuliaArrays/StaticArrayInterface.jl#3 · 10 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
All issues in JuliaArrays/StaticArrayInterface.jl
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
CliMA/Oceananigans.jl#6066 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
JuliaLang/LinearAlgebra.jl#1707 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
JuliaAstro/AstroImages.jl#140 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 90/100