Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to list elements selected by an index #164

Open
asmeurer opened this issue Nov 14, 2023 · 0 comments
Open

Function to list elements selected by an index #164

asmeurer opened this issue Nov 14, 2023 · 0 comments

Comments

@asmeurer
Copy link
Member

For example, for slice(None), [0, 1, 0] on an array of shape (3, 2), it should list

(0, 0)
(0, 1)
(0, 0)
(1, 0)
(1, 1)
(1, 0)
(2, 0)
(2, 1)
(2, 0)

The function would always take in a shape.

I think this should be pretty straightforward to implement. Just call expand() on the index and iterate through an itertools.product.

The function should maybe be called idx.selected_elements(shape).

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

No branches or pull requests

1 participant