Skip to content

Implementing new IndexStyle / type of index? #38284

@Luapulu

Description

@Luapulu

I've been working on adding a TiledIndex with a IndexTiled <: IndexStyle, for all sorts of arrays that are best indexed into via an index representing the tile and an index within that tile. See issue in TiledIteration.jl. Along the way I had a few thoughts:

  1. Should reduce operations and possibly a number of others dispatch on IndexStyle, thus allowing users to implement new index types along with efficient algorithms for those index types.
  2. Same thought goes for Base.to_index and Base.to_indices. Should these dispatch on the IndexStyle, so that indices are converted to the correct type, based on the IndexStyle. This would allow any user defined index to work with any array type as long as the relevant to_index and to_indices functions are implemented!
  3. Should we add a section in the manual on implementing new index types. It could extend the section on Arrays with custom indices

May be I've misunderstood the point of IndexStyle. If that's the case, can anyone point me to some resources on implementing custom indexing? The docs only have a section for adding offset indexing, but not for more complicated indexing.

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