Support for .multi_slice_axis_mut and .multi_slice_axis_move

Open
#836 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
data

Research direction

Start by reading the existing multi_slice_mut and slice_axis_mut APIs, which the issue identifies as the relevant precedents. Trace how their returned views and axis handling work, then define the corresponding behavior for multi_slice_axis_mut and multi_slice_axis_move. Done means the shown Axis(0) example is supported with the expected four views.

Written by the indexing model from the issue text.

Description

enhancement

From #775:

We should add multi_slice_axis_mut and multi_slice_axis_move methods, in the same way that slice_axis_mut is analogous to slice_mut.

Are the methods multi_slice_axis_mut and multi_slice_axis_move still desired? I was looking for such functionality. If so, based on multi_slice_mut, is my understanding correct in that these two methods would make the following possible?

let mut example = array![
   [0, 0, 0],
   [0, 0, 0],
   [1, 2, 3],
   [4, 5, 6],
   [7, 8, 9],
   [0, 0, 0],
   [0, 0, 0],
];

let (mut pad_lo, mut pad_hi, mut edge_lo, mut edge_hi) =
    example.multi_slice_axis_mut(Axis(0), (s![..2], s![5..], s![2], s![4]));
// pad_lo:  [ [ 0, 0, 0 ],
//            [ 0, 0, 0 ] ]
// pad_hi:  [ [ 0, 0, 0 ],
//            [ 0, 0, 0 ] ]
// edge_lo: [ [ 1, 2, 3 ] ] 
// edge_hi: [ [ 7, 8, 9 ] ]

Although I'm still learning a lot about Rust, I would love to give implementing it a try, if the functionality is still on the to-do list.

It'd also come in handy for the ndarray-pad crate I'm working on!


I moved this into its own separate issue to not clutter the mentioned issue.

Dominant language
Rust
Stars
4.3k
Forks
391
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 rust-ndarray/ndarray

All issues in rust-ndarray/ndarray

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.