Skip to content

How to get a Slice/View rom an arbirary vec/iterable of integers(ie indixes)? #1183

Answered by bluss
AnatolyBuga asked this question in Q&A
Discussion options

You must be logged in to vote

Views and thus slicing can only represent consistent strides. I.e you make a lattice that you overlay on top of the original array, skipping as many elements as the stride for that axis says. Thus we can't do this, since we don't have a regular grid here, we are skipping different numbers of steps in different places.

However, .select(), the method, can copy out particular indexes along an axis.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bluss
Comment options

@AnatolyBuga
Comment options

Answer selected by AnatolyBuga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants