Skip to content

Function to list elements selected by an index #164

@asmeurer

Description

@asmeurer

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions