Skip to content

Omitted and additionally indexed dimensions in getindex #5396

Closed

Description

There are some aspects of getindex.
Let A is a n-dimensional array, say 4-dimensional with size(A) == (2,3,2,2),

  • Dimensions left out get flattened into the last indexed dimension, so for example
    A[i, k]==A[i,:,:,:][k] for k in 1:12
    This seems to be a consistent generalization of A[:] transforming the array to a vector.
  • Also additional indexes of the form 1, : and equivalent 1:1 (additional to the n dimensions) can be provided. For example
    A[2,3,2,2, 1, 1] ~ Int64 A[2,3,2,2, :, 1] ~ 1x1x1x1x1 Array{Int64,5}
    (In both cases as usual the trailing integer-indexed dimension are removed)

Which behaviors are desired, which are artifacts from the implementation, which should be documented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    docsThis change adds or pertains to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions