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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BlockBandedMatrices"
uuid = "ffab5731-97b5-5995-9138-79e8c1846df0"
version = "0.13.1"
version = "0.13.2"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
26 changes: 21 additions & 5 deletions src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@
end


blockbandwidths(bc::Broadcasted{<:Union{Nothing,BroadcastStyle},<:Any,typeof(*)}) =
min.(_broadcast_blockbandwidths.(Ref(_blockbnds(bc)), bc.args, Ref(axes(bc)))...)
function blockbandwidths(bc::Broadcasted{<:Union{Nothing,BroadcastStyle},<:Any,typeof(*)})
ax = axes(bc)
blkinds = _blockbnds(bc)
t = map(bc.args) do x
_broadcast_blockbandwidths(blkinds, x, ax)
end
min.(t...)
end

blockbandwidths(bc::Broadcasted{<:Union{Nothing,BroadcastStyle},<:Any,typeof(/)}) = _broadcast_blockbandwidths(_blockbnds(bc), first(bc.args), axes(bc))
blockbandwidths(bc::Broadcasted{<:Union{Nothing,BroadcastStyle},<:Any,typeof(\)}) = _broadcast_blockbandwidths(_blockbnds(bc), last(bc.args), axes(bc))
Expand All @@ -76,16 +82,26 @@
subblockbandwidths(A) # need to special case vector broadcasting
end

subblockbandwidths(bc::Broadcasted{<:Union{Nothing,BroadcastStyle},<:Any,typeof(*)}) =
min.(_broadcast_subblockbandwidths.(Ref(_subblockbnds(bc)), bc.args)...)
function subblockbandwidths(bc::Broadcasted{<:Union{Nothing,BroadcastStyle},<:Any,typeof(*)})

Check warning on line 85 in src/broadcast.jl

View check run for this annotation

Codecov / codecov/patch

src/broadcast.jl#L85

Added line #L85 was not covered by tests
subbbw = _subblockbnds(bc)
t = map(bc.args) do x
_broadcast_subblockbandwidths(subbbw, x)
end
min.(t...)
end

subblockbandwidths(bc::Broadcasted{<:Union{Nothing,BroadcastStyle},<:Any,typeof(/)}) = _broadcast_subblockbandwidths(_subblockbnds(bc), first(bc.args))
subblockbandwidths(bc::Broadcasted{<:Union{Nothing,BroadcastStyle},<:Any,typeof(\)}) = _broadcast_subblockbandwidths(_subblockbnds(bc), last(bc.args))

function subblockbandwidths(bc::Broadcasted)
(a,b) = size(bc)
bnds = (a-1,b-1)
_isweakzero(bc.f, bc.args...) && return min.(bnds, max.(_broadcast_subblockbandwidths.(Ref(bnds), bc.args)...))
if _isweakzero(bc.f, bc.args...)
t = map(bc.args) do x
_broadcast_subblockbandwidths(bnds, x)
end
return min.(bnds, max.(t...))
end
bnds
end

Expand Down
Loading