Take non-contiguous slices #1050
Unanswered
multimeric
asked this question in
Q&A
Replies: 1 comment 1 reply
-
ArrayView does not support representing that subset as one view, since it works by using one size and one stride per axis (the subset cannot be described that way). What's wanted is called "fancy indexing" sometimes and it makes sense. The question is what a useful and general interface to it would look like in Rust. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say I have a 4x4 array and I want to take rows 0, 1, and 3, and columns 0, 1, and 3.
I can't use
slice()
here, because slice only takes ranges and single indices:I can use
select()
, but since I want to slice along two different axes, this will copy the array twice instead of once:Is there a better way to do this?
My ideal would be a way to not have to copy the array at all, and just have a view of the array that excludes this row/column index. If the view machinery can't support this (which would be a bit surprising considering it supports slicing with ranges with arbitrary steps), then the next best solution would be a multi-dimensional
select()
method that lets me do this all in one step.Beta Was this translation helpful? Give feedback.
All reactions