Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Jun 27, 2023

This parallels CartesianIndices, and provides a convenient way to iterate over the blocks:

julia> B = mortar(fill(rand(1,1),2,2))
2×2-blocked 2×2 BlockMatrix{Float64}:
 0.5756170.575617
 ──────────┼──────────
 0.5756170.575617

julia> BlockRange(B)
BlockRange(Base.OneTo(2), Base.OneTo(2))

julia> BlockRange(B) |> collect
2×2 Matrix{Block{2, Int64}}:
 Block(1, 1)  Block(1, 2)
 Block(2, 1)  Block(2, 2)

@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Merging #285 (0cc808e) into master (b03703f) will increase coverage by 91.91%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           master     #285       +/-   ##
===========================================
+ Coverage    0.00%   91.91%   +91.91%     
===========================================
  Files          16       16               
  Lines        1462     1485       +23     
===========================================
+ Hits            0     1365     +1365     
+ Misses       1462      120     -1342     
Impacted Files Coverage Δ
src/blocklinalg.jl 94.44% <ø> (+94.44%) ⬆️
src/abstractblockarray.jl 92.30% <100.00%> (+92.30%) ⬆️
src/blockarray.jl 96.29% <100.00%> (+96.29%) ⬆️
src/blockaxis.jl 95.68% <100.00%> (+95.68%) ⬆️
src/blockindices.jl 83.41% <100.00%> (+83.41%) ⬆️
src/show.jl 100.00% <100.00%> (+100.00%) ⬆️

... and 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@testset "StaticArrays" begin
@test blockisequal(blockedrange(SVector(1,2,3)), blockedrange([1,2,3]))
@test @allocated(blockedrange(SVector(1,2,3))) == 0
# @test @allocated(blockedrange(SVector(1,2,3))) == 0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've disabled the allocations test, as this is often unreliable while performing tests

@jishnub jishnub merged commit a930509 into JuliaArrays:master Jun 28, 2023
@jishnub jishnub deleted the blockrangeblockarray branch June 28, 2023 07:01
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