@@ -297,11 +297,6 @@ _broadcast_eltype(f, A, Bs...) = Base._return_type(f, eltypestuple(A, Bs...))
297
297
end
298
298
return broadcast_t (f, Any, shape, iter, A, Bs... )
299
299
end
300
- function broadcast_c (f, :: Type{Tuple} , As... )
301
- shape = broadcast_indices (As... )
302
- n = length (shape[1 ])
303
- return ntuple (k-> f ((_broadcast_getindex (A, k) for A in As). .. ), n)
304
- end
305
300
@inline function broadcast_c (f, :: Type{Nullable} , a... )
306
301
nonnull = all (hasvalue, a)
307
302
S = _broadcast_eltype (f, a... )
316
311
end
317
312
end
318
313
@inline broadcast_c (f, :: Type{Any} , a... ) = f (a... )
314
+ broadcast_c (f, :: Type{Tuple} , As... ) =
315
+ ntuple (k -> f (_tuplebroadcast_getargs (As, k)... ), _tuplebroadcast_reslength (As))
316
+ broadcast_c {T} (f, :: Type{Tuple} , :: Type{T} , As... ) =
317
+ ntuple (k -> f (T, _tuplebroadcast_getargs (As, k)... ), _tuplebroadcast_reslength (As))
318
+ @inline _tuplebroadcast_getargs (:: Tuple{} , k) = ()
319
+ @inline _tuplebroadcast_getargs (As, k) =
320
+ (_broadcast_getindex (first (As), k), _tuplebroadcast_getargs (tail (As), k)... )
321
+ @noinline _tuplebroadcast_reslength (As) =
322
+ _tuplebroadcast_maxlength (_tuplebroadcast_length (first (As)), tail (As))
323
+ @inline _tuplebroadcast_maxlength (l, As) =
324
+ _tuplebroadcast_maxlength (max (l, _tuplebroadcast_length (first (As))), tail (As))
325
+ @inline _tuplebroadcast_maxlength (l, :: Tuple{} ) = l
326
+ @inline _tuplebroadcast_length (t:: Tuple ) = length (t)
327
+ @inline _tuplebroadcast_length (s) = 1
319
328
320
329
"""
321
330
broadcast(f, As...)
0 commit comments