Skip to content

Commit 808bbe8

Browse files
authored
fix error with empty rowsupport in. broadcast (#341)
1 parent dda2826 commit 808bbe8

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BandedMatrices"
22
uuid = "aae01518-5342-5314-be14-df237901396f"
3-
version = "0.17.16"
3+
version = "0.17.17"
44

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

src/generic/broadcast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ function checkzerobands(dest, f, (A,B)::NTuple{2,AbstractMatrix})
693693

694694
rspA = rowsupport(A)
695695
rspB = rowsupport(B)
696-
for j = min(minimum(rspA), minimum(rspB)):max(maximum(rspA), maximum(rspB))
696+
for j = min(first(rspA), first(rspB)):max(last(rspA), last(rspB))
697697
for k = max(1,j-u) : min(j-d_u-1,m)
698698
iszero(f(A[k,j], B[k,j])) || throw(BandError(dest,b))
699699
end

test/test_broadcasting.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,5 +706,9 @@ import BandedMatrices: BandedStyle, BandedRows
706706
copyto!(A, Z)
707707
copyto!(B, Z)
708708
@test A == B == zeros(5,5)
709+
710+
a = BandedMatrix(Zeros(0,4), (-1,1))
711+
b = BandedMatrix(Zeros(0,4), (-1,2))
712+
@test a-b == a
709713
end
710714
end

0 commit comments

Comments
 (0)