@@ -142,8 +142,13 @@ function _generic_blockbroadcast_copyto!(dest::AbstractArray,
142142
143143 bc = Broadcast. flatten (bc1)
144144 NArgs = length (bc. args)
145-
146145 bs = axes (bc)
146+
147+ if ! all (a -> ! (a isa AbstractArray) || size (a) == size (dest), bc. args)
148+ # code below assumes only scalars and matching sizes. We therefore go back to default.
149+ return copyto! (dest, Broadcasted {DefaultArrayStyle{NDims}} (bc. f, bc. args, bs))
150+ end
151+
147152 if ! blockisequal (axes (dest), bs)
148153 copyto! (BlockedArray (dest, bs), bc)
149154 return dest
@@ -267,14 +272,12 @@ BroadcastStyle(::Type{<:SubArray{<:Any,N,<:BlockedArray,I}}) where {N,I<:Tuple{A
267272for op in (:* , :/ )
268273 @eval begin
269274 broadcasted (:: AbstractBlockStyle , :: typeof ($ op), a:: Zeros , b:: AbstractArray ) = FillArrays. _broadcasted_zeros ($ op, a, b)
270- broadcasted (:: AbstractBlockStyle , :: typeof ($ op), a:: Ones{T} , b:: AbstractArray{V} ) where {T,V} = LinearAlgebra. copy_oftype (b, Base. promote_op (* , T, V))
271275 end
272276end
273277
274278for op in (:* , :\ )
275279 @eval begin
276280 broadcasted (:: AbstractBlockStyle , :: typeof ($ op), a:: AbstractArray , b:: Zeros ) = FillArrays. _broadcasted_zeros ($ op, a, b)
277- broadcasted (:: AbstractBlockStyle , :: typeof ($ op), a:: AbstractArray{T} , b:: Ones{V} ) where {T,V} = LinearAlgebra. copy_oftype (a, Base. promote_op (* , T, V))
278281 end
279282end
280283
0 commit comments