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

Index into a CartesianIndices with a Block #354

Merged
merged 5 commits into from
Mar 28, 2024
Merged

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Mar 26, 2024

After this, indexing into a CartesianIndices with a Block produces a CartesianIndices if the ndims match.

julia> B = BlockArray(reshape([1:9;],3,3), [2,1], [2,1])
2×2-blocked 3×3 BlockMatrix{Int64}:
 1  47
 2  58
 ──────┼───
 3  69

julia> C = CartesianIndices(B)
CartesianIndices((1:1:3, 1:1:3))

julia> C[Block(1,1)]
CartesianIndices((1:2, 1:2))

This addresses the comment in #346 (comment)

The indexing operation C[Block(1), Block(1)] should also work identically, but this is WIP. works identically:

julia> C[Block(1), Block(1)]
CartesianIndices((1:2, 1:2))

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.47%. Comparing base (ea33af1) to head (53a2f7d).
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #354      +/-   ##
==========================================
+ Coverage   92.66%   94.47%   +1.81%     
==========================================
  Files          16       16              
  Lines        1499     1503       +4     
==========================================
+ Hits         1389     1420      +31     
+ Misses        110       83      -27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jishnub jishnub merged commit 2ce8d26 into master Mar 28, 2024
13 checks passed
@jishnub jishnub deleted the jishnub/blocksliceview branch March 28, 2024 08:58
@mtfishman mtfishman mentioned this pull request Mar 28, 2024
4 tasks
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

Successfully merging this pull request may close these issues.

1 participant