Skip to content

Commit a76f945

Browse files
authored
Handle out-of-bounds blockcolstop/blockrowstop (#192)
* Handle out-of-bounds blockcolstop/blockrowstop * Add test * Bump version to v0.12.11
1 parent 7df446b commit a76f945

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BlockBandedMatrices"
22
uuid = "ffab5731-97b5-5995-9138-79e8c1846df0"
3-
version = "0.12.10"
3+
version = "0.12.11"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/AbstractBlockBandedMatrix.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ end
161161

162162
@inline function blockbanded_colstop(A, i::Integer)
163163
CS = blockcolstop(A,findblock(axes(A,2),i))
164-
CS == Block(0) && return 0
164+
CS in blockaxes(axes(A,1), 1) || return 0
165165
last(axes(A,1)[CS])
166166
end
167167

@@ -178,7 +178,7 @@ end
178178

179179
@inline function blockbanded_rowstop(A, i::Integer)
180180
CS = blockrowstop(A,findblock(axes(A,1),i))
181-
CS == Block(0) && return 0
181+
CS in blockaxes(axes(A,2), 1) || return 0
182182
last(axes(A,2)[CS])
183183
end
184184

test/test_blockskyline.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,10 @@ Random.seed!(0)
156156
end
157157
end
158158
end
159+
160+
@testset "indexing" begin
161+
B = BlockSkylineMatrix{Bool}(I, 1:1, 1:4, ([0,0,0,0],[0,1,1,1]))
162+
s = split(sprint(show, "text/plain", B), '\n')[2]
163+
@test s == " 1 │ 0 0 │ ⋅ ⋅ ⋅ │ ⋅ ⋅ ⋅ ⋅"
164+
end
159165
end

0 commit comments

Comments
 (0)