Skip to content

Commit 976e100

Browse files
authored
Fix bug in broadcast (#72)
* Fix bug in broadcast * more tests * Update test_broadcasting.jl
1 parent 7fbebff commit 976e100

File tree

3 files changed

+209
-174
lines changed

3 files changed

+209
-174
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.8.2"
3+
version = "0.8.3"
44

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

src/broadcast.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,25 +267,32 @@ for op in (:+, :-)
267267

268268
for= 1:M
269269
J = Block(J̃)
270+
# joint block range
270271
for K = Block.(max(1,J̃-min(A_u,B_u)):min(N,J̃+min(A_l,B_l)))
271272
view(C,K,J) .= $op.(view(A,K,J), view(B,K,J))
272273
end
274+
# above, A but not B
273275
for K = Block.(max(1,J̃-A_u):min(N,J̃-B_u-1))
274276
view(C,K,J) .= view(A,K,J)
275277
end
278+
# above, B but not A
276279
for K = Block.(max(1,J̃-B_u):min(N,J̃-A_u-1))
277280
view(C,K,J) .= $op.(view(B,K,J))
278281
end
279-
for K = Block.(max(1,J̃+B_l+1):min(N,J̃+A_u))
282+
# below, A but not B
283+
for K = Block.(max(1,J̃+B_l+1):min(N,J̃+A_l))
280284
view(C,K,J) .= view(A,K,J)
281285
end
282-
for K = Block.(max(1,J̃+A_l+1):min(N,J̃+B_u))
286+
# below, B but not A
287+
for K = Block.(max(1,J̃+A_l+1):min(N,J̃+B_l))
283288
view(C,K,J) .= $op.(view(B,K,J))
284289
end
290+
# above, neither
285291
for K = Block.(max(J̃-C_u,1):min(J̃-max(A_u,B_u)-1,N))
286292
view(C,K,J) .= zero(T)
287293
end
288-
for K = Block.(max(J̃+max(A_l,B_l)+1,1):min(J̃+C_u,N))
294+
# below, neither
295+
for K = Block.(max(J̃+max(A_l,B_l)+1,1):min(J̃+C_l,N))
289296
view(C,K,J) .= zero(T)
290297
end
291298
end

0 commit comments

Comments
 (0)