JuliaArrays / JuliaArrays/StaticArrayInterface.jl

Bug in `strides` for reshaped views

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

Nobody has claimed this yet.

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

Description

julia> using ArrayInterface

julia> u_base = randn(10, 10); u_view = view(u_base, 3, :); u_reshaped_view1 = reshape(u_view, 1, :); u_reshaped_view2 = reshape(u_view, 2, :);

julia> ArrayInterface.strides(u_reshaped_view1)
(static(1), 1)

julia> ArrayInterface.strides(u_reshaped_view2)
(static(1), 2)

These seem to be wrong, I think. Because of ArrayInterface.strides(u_view) == (10,), the strides should be

  • ArrayInterface.strides(u_reshaped_view1) = (10 #= doesn't matter since there is only one element in this dimension =#, 10)
  • ArrayInterface.strides(u_reshaped_view1) = (10, 20)

Is that correct?

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.

Research direction

Start by reproducing the reported Julia REPL cases for ArrayInterface.strides on u_view and the two reshaped views. Trace the strides entry point for view and reshape behavior, then compare the results with the expected (10,) and (10, 20) semantics. Done means the behavior is clarified or corrected and the reported cases are covered by tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.