Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@
function blockbandwidths(bc::Broadcasted)
(a,b) = size(bc)
bnds = (a-1,b-1)
_isweakzero(bc.f, bc.args...) && return min.(bnds, max.(_broadcast_blockbandwidths.(Ref(bnds), bc.args, Ref(axes(bc)))...))
if _isweakzero(bc.f, bc.args...)
ax = axes(bc)
t = map(bc.args) do x
_broadcast_blockbandwidths(bnds, x, ax)

Check warning on line 102 in src/broadcast.jl

View check run for this annotation

Codecov / codecov/patch

src/broadcast.jl#L99-L102

Added lines #L99 - L102 were not covered by tests
end
return min.(bnds, max.(t...))

Check warning on line 104 in src/broadcast.jl

View check run for this annotation

Codecov / codecov/patch

src/broadcast.jl#L104

Added line #L104 was not covered by tests
end
bnds
end

Expand Down
8 changes: 8 additions & 0 deletions test/test_broadcasting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ import Base: oneto
@test C == A + A
end
end

@testset "blockbandwidths" begin
B = BlockArray(ones(6,6), 1:3, 1:3)
BB = BlockBandedMatrix(B, (1,1))
bc = Broadcast.broadcasted(+, BB, BB)
bbw = @inferred blockbandwidths(bc)
@test bbw == blockbandwidths(BB)
end
end

end # module
Loading