Skip to content

Commit 9365dea

Browse files
authored
rowsupport in checkzerobands for two matrices (#318)
* rowsupport in checkzerobands for two matrices * skip zerobands check for higher dest bandwidth
1 parent 1e6ad02 commit 9365dea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/generic/broadcast.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function checkzerobands(dest, f, A::AbstractMatrix)
7777
d_l, d_u = bandwidths(dest)
7878
l, u = bandwidths(A)
7979

80-
if (l,u) (d_l,d_u)
80+
if !(d_l >= l && d_u >= u)
8181
for j = rowsupport(A)
8282
for k = max(1,j-u) : min(j-d_u-1,m)
8383
iszero(f(A[k,j])) || throw(BandError(dest,j-k))
@@ -679,7 +679,9 @@ function checkzerobands(dest, f, (A,B)::Tuple{AbstractMatrix,AbstractMatrix})
679679
B_l, B_u = bandwidths(B)
680680
l, u = max(A_l,B_l), max(A_u,B_u)
681681

682-
for j = 1:n
682+
rspA = rowsupport(A)
683+
rspB = rowsupport(B)
684+
for j = min(minimum(rspA), minimum(rspB)):max(maximum(rspA), maximum(rspB))
683685
for k = max(1,j-u) : min(j-d_u-1,m)
684686
iszero(f(A[k,j], B[k,j])) || throw(BandError(dest,b))
685687
end

0 commit comments

Comments
 (0)