Skip to content

[NDArray] unify the __getitem__ slice overloads#353

Merged
forfudan merged 3 commits into
Mojo-Numerics-and-Algorithms-group:pre-0.10from
shivasankarka:improve_ndarray
May 7, 2026
Merged

[NDArray] unify the __getitem__ slice overloads#353
forfudan merged 3 commits into
Mojo-Numerics-and-Algorithms-group:pre-0.10from
shivasankarka:improve_ndarray

Conversation

@shivasankarka

@shivasankarka shivasankarka commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Changes:

  • __getitem__(*slices: Slice) wraps each Slice into IndexTypes and calls __getitem__(*slices: IndexTypes).
  • __getitem__(slice_list: List[Slice]) similarly wraps and delegates.
  • __getitem__(*slices: IndexTypes) is the single implementation.
  • _getitem_list_slices (internal helper with dimension-reducing semantics for computation compatibility) is kept as-is since it has different behavior.
  • Fix the issue in ellipsis expansion when there are other indices provided such as arr[..., -1].
  • Fix pixi-backend mojo version.

@shivasankarka shivasankarka changed the title unify the getitem slice overloads [NDArray] unify the __getitem__ slice overloads May 7, 2026
@shivasankarka
shivasankarka requested review from forfudan May 7, 2026 07:45

@forfudan forfudan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clear for merging

@forfudan
forfudan merged commit bd1a8f7 into Mojo-Numerics-and-Algorithms-group:pre-0.10 May 7, 2026
2 checks passed
@shivasankarka
shivasankarka deleted the improve_ndarray branch May 7, 2026 15:40
shivasankarka added a commit to shivasankarka/NuMojo that referenced this pull request May 8, 2026
…Algorithms-group#353)

- `__getitem__(*slices: Slice)` wraps each `Slice` into `IndexTypes` and
calls `__getitem__(*slices: IndexTypes)`.
- `__getitem__(slice_list: List[Slice])` similarly wraps and delegates.
- `__getitem__(*slices: IndexTypes)` is the single implementation.
- `_getitem_list_slices` (internal helper with dimension-reducing
semantics for computation compatibility) is kept as-is since it has
different behavior.
- Fix the issue in ellipsis expansion when there are other indices
provided such as `arr[..., -1]`.
- Fix pixi-backend mojo version.
shivasankarka added a commit to shivasankarka/NuMojo that referenced this pull request May 8, 2026
…Algorithms-group#353)

- `__getitem__(*slices: Slice)` wraps each `Slice` into `IndexTypes` and
calls `__getitem__(*slices: IndexTypes)`.
- `__getitem__(slice_list: List[Slice])` similarly wraps and delegates.
- `__getitem__(*slices: IndexTypes)` is the single implementation.
- `_getitem_list_slices` (internal helper with dimension-reducing
semantics for computation compatibility) is kept as-is since it has
different behavior.
- Fix the issue in ellipsis expansion when there are other indices
provided such as `arr[..., -1]`.
- Fix pixi-backend mojo version.
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.

2 participants