Skip to content

Functionality for slicing with unit ranges that preserves block information #347

Description

@mtfishman

Indexing with UnitRange does not preserve the blocking of blocked arrays:

julia> using BlockArrays

julia> r = blockedrange([2, 4])
2-blocked 6-element BlockedUnitRange{Int64, Vector{Int64}}:
 1
 23
 4
 5
 6

julia> r[2:4]
2:4

and:

julia> a = BlockArray(randn(4, 4), [2, 2], [2, 2])
2×2-blocked 4×4 BlockMatrix{Float64}:
 0.372344   -0.7351090.316133  -0.935035
 2.37641     1.30943-0.931113   0.339143
 ──────────────────────┼──────────────────────
 0.422144    0.839572-1.4721    -0.74205 
 0.0436636  -0.7229460.799941  -0.192523

julia> a[2:3, 2:3]
2×2 Matrix{Float64}:
 1.30943   -0.931113
 0.839572  -1.4721

It would be nice to have convenient functionality for indexing with UnitRange that does preserve blocking.

Activity

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

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