Skip to content

make A[begin:stride:end] work#4

Merged
mkitti merged 4 commits into
JuliaIO:mainfrom
bjarthur:bja/index
May 7, 2026
Merged

make A[begin:stride:end] work#4
mkitti merged 4 commits into
JuliaIO:mainfrom
bjarthur:bja/index

Conversation

@bjarthur
Copy link
Copy Markdown
Member

also mostly from claude

@mkitti
Copy link
Copy Markdown
Member

mkitti commented Apr 16, 2026

Thr main deficit is that begin and end do not work for indexing, I believe.

@bjarthur
Copy link
Copy Markdown
Member Author

they work for me with this PR. i'll add some tests.

julia> size(A)
(1000, 20000)

julia> A[1:3:10,1]
TensorStore(UInt32, rank=1, shape=(4,))

julia> A[1:3:10,1].read().result()
4-element PyArray{UInt32, 1}:
 0x00000000
 0x00000000
 0x00000000
 0x00000000

julia> A[begin:3:10,1].read().result()
4-element PyArray{UInt32, 1}:
 0x00000000
 0x00000000
 0x00000000
 0x00000000

julia> A[end-10:3:end,1].read().result()
4-element PyArray{UInt32, 1}:
 0x00000000
 0x00000000
 0x00000000
 0x00000000

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing Julia array-indexing hooks so begin:stride:end slicing works on TensorStoreWrapper views (including labeled sub-views), and validates the behavior with new tests.

Changes:

  • Implemented Base.axes(w, d), Base.firstindex(w, d), and Base.lastindex(w, d) for TensorStoreWrapper and IndexDomainWrapper.
  • Added tests covering firstindex/lastindex and strided slicing with begin:2:end on both full and labeled sub-views.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/runtests.jl Adds assertions for firstindex/lastindex and begin:2:end slicing size behavior.
src/TensorStoreWrapper.jl Adds dimension-specific axes/firstindex/lastindex to enable begin/end lowering in slicing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mkitti mkitti merged commit ed388db into JuliaIO:main May 7, 2026
8 checks passed
@bjarthur bjarthur deleted the bja/index branch May 7, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants