@@ -842,8 +842,8 @@ julia> string.(("one","two","three","four"), ": ", 1:4)
842
842
broadcast (f:: Tf , As... ) where {Tf} = materialize (broadcasted (f, As... ))
843
843
844
844
# special cases defined for performance
845
- @inline broadcast (f, x:: Number... ) = f (x... )
846
- @inline broadcast (f, t:: NTuple{N,Any} , ts:: Vararg{NTuple{N,Any}} ) where {N} = map (f, t, ts... )
845
+ broadcast (f, x:: Number... ) = f (x... )
846
+ broadcast (f, t:: NTuple{N,Any} , ts:: Vararg{NTuple{N,Any}} ) where {N} = map (f, t, ts... )
847
847
848
848
"""
849
849
broadcast!(f, dest, As...)
@@ -901,28 +901,28 @@ end
901
901
902
902
Take a lazy `Broadcasted` object and compute the result
903
903
"""
904
- @inline materialize (bc:: Broadcasted ) = copy (instantiate (bc))
904
+ materialize (bc:: Broadcasted ) = copy (instantiate (bc))
905
905
materialize (x) = x
906
906
907
- @inline function materialize! (dest, x)
907
+ function materialize! (dest, x)
908
908
return materialize! (dest, instantiate (Broadcasted (identity, (x,), axes (dest))))
909
909
end
910
910
911
- @inline function materialize! (dest, bc:: Broadcasted{Style} ) where {Style}
911
+ function materialize! (dest, bc:: Broadcasted{Style} ) where {Style}
912
912
return materialize! (combine_styles (dest, bc), dest, bc)
913
913
end
914
- @inline function materialize! (:: BroadcastStyle , dest, bc:: Broadcasted{Style} ) where {Style}
914
+ function materialize! (:: BroadcastStyle , dest, bc:: Broadcasted{Style} ) where {Style}
915
915
return copyto! (dest, instantiate (Broadcasted {Style} (bc. f, bc. args, axes (dest))))
916
916
end
917
917
918
918
# # general `copy` methods
919
- @inline copy (bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = bc[CartesianIndex ()]
919
+ copy (bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = bc[CartesianIndex ()]
920
920
copy (bc:: Broadcasted{<:Union{Nothing,Unknown}} ) =
921
921
throw (ArgumentError (" broadcasting requires an assigned BroadcastStyle" ))
922
922
923
923
const NonleafHandlingStyles = Union{DefaultArrayStyle,ArrayConflict}
924
924
925
- @inline function copy (bc:: Broadcasted{Style} ) where {Style}
925
+ function copy (bc:: Broadcasted{Style} ) where {Style}
926
926
ElType = combine_eltypes (bc. f, bc. args)
927
927
if Base. isconcretetype (ElType)
928
928
# We can trust it and defer to the simpler `copyto!`
@@ -954,10 +954,10 @@ end
954
954
# # general `copyto!` methods
955
955
# The most general method falls back to a method that replaces Style->Nothing
956
956
# This permits specialization on typeof(dest) without introducing ambiguities
957
- @inline copyto! (dest:: AbstractArray , bc:: Broadcasted ) = copyto! (dest, convert (Broadcasted{Nothing}, bc))
957
+ copyto! (dest:: AbstractArray , bc:: Broadcasted ) = copyto! (dest, convert (Broadcasted{Nothing}, bc))
958
958
959
959
# Performance optimization for the common identity scalar case: dest .= val
960
- @inline function copyto! (dest:: AbstractArray , bc:: Broadcasted{<:AbstractArrayStyle{0}} )
960
+ function copyto! (dest:: AbstractArray , bc:: Broadcasted{<:AbstractArrayStyle{0}} )
961
961
# Typically, we must independently execute bc for every storage location in `dest`, but:
962
962
# IF we're in the common no-op identity case with no nested args (like `dest .= val`),
963
963
if bc. f === identity && bc. args isa Tuple{Any} && isflat (bc)
@@ -989,7 +989,7 @@ preprocess_args(dest, args::Tuple{Any}) = (preprocess(dest, args[1]),)
989
989
preprocess_args (dest, args:: Tuple{} ) = ()
990
990
991
991
# Specialize this method if all you want to do is specialize on typeof(dest)
992
- @inline function copyto! (dest:: AbstractArray , bc:: Broadcasted{Nothing} )
992
+ function copyto! (dest:: AbstractArray , bc:: Broadcasted{Nothing} )
993
993
axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
994
994
# Performance optimization: broadcast!(identity, dest, A) is equivalent to copyto!(dest, A) if indices match
995
995
if bc. f === identity && bc. args isa Tuple{AbstractArray} # only a single input argument to broadcast!
@@ -1009,7 +1009,7 @@ end
1009
1009
1010
1010
# Performance optimization: for BitArray outputs, we cache the result
1011
1011
# in a "small" Vector{Bool}, and then copy in chunks into the output
1012
- @inline function copyto! (dest:: BitArray , bc:: Broadcasted{Nothing} )
1012
+ function copyto! (dest:: BitArray , bc:: Broadcasted{Nothing} )
1013
1013
axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
1014
1014
ischunkedbroadcast (dest, bc) && return chunkedcopyto! (dest, bc)
1015
1015
length (dest) < 256 && return invoke (copyto!, Tuple{AbstractArray, Broadcasted{Nothing}}, dest, bc)
@@ -1065,7 +1065,7 @@ liftchunks(args::Tuple{<:Bool,Vararg{Any}}) = (ifelse(args[1], typemax(UInt64),
1065
1065
ithchunk (i) = ()
1066
1066
Base. @propagate_inbounds ithchunk (i, c:: Vector{UInt64} , args... ) = (c[i], ithchunk (i, args... )... )
1067
1067
Base. @propagate_inbounds ithchunk (i, b:: UInt64 , args... ) = (b, ithchunk (i, args... )... )
1068
- @inline function chunkedcopyto! (dest:: BitArray , bc:: Broadcasted )
1068
+ function chunkedcopyto! (dest:: BitArray , bc:: Broadcasted )
1069
1069
isempty (dest) && return dest
1070
1070
f = flatten (liftfuncs (bc))
1071
1071
args = liftchunks (f. args)
@@ -1112,7 +1112,7 @@ end
1112
1112
1113
1113
# # Tuple methods
1114
1114
1115
- @inline function copy (bc:: Broadcasted{Style{Tuple}} )
1115
+ function copy (bc:: Broadcasted{Style{Tuple}} )
1116
1116
dim = axes (bc)
1117
1117
length (dim) == 1 || throw (DimensionMismatch (" tuple only supports one dimension" ))
1118
1118
N = length (dim[1 ])
@@ -1196,15 +1196,15 @@ struct BitMaskedBitArray{N,M}
1196
1196
mask:: BitArray{M}
1197
1197
BitMaskedBitArray {N,M} (parent, mask) where {N,M} = new (parent, mask)
1198
1198
end
1199
- @inline function BitMaskedBitArray (parent:: BitArray{N} , mask:: BitArray{M} ) where {N,M}
1199
+ function BitMaskedBitArray (parent:: BitArray{N} , mask:: BitArray{M} ) where {N,M}
1200
1200
@boundscheck checkbounds (parent, mask)
1201
1201
BitMaskedBitArray {N,M} (parent, mask)
1202
1202
end
1203
1203
Base. @propagate_inbounds dotview (B:: BitArray , i:: BitArray ) = BitMaskedBitArray (B, i)
1204
1204
Base. show (io:: IO , B:: BitMaskedBitArray ) = foreach (arg-> show (io, arg), (typeof (B), (B. parent, B. mask)))
1205
1205
# Override materialize! to prevent the BitMaskedBitArray from escaping to an overrideable method
1206
- @inline materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}} ) = fill! (B, bc. args[1 ])
1207
- @inline materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any} ) = materialize! (SubArray (B. parent, to_indices (B. parent, (B. mask,))), bc)
1206
+ materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}} ) = fill! (B, bc. args[1 ])
1207
+ materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any} ) = materialize! (SubArray (B. parent, to_indices (B. parent, (B. mask,))), bc)
1208
1208
function Base. fill! (B:: BitMaskedBitArray , b:: Bool )
1209
1209
Bc = B. parent. chunks
1210
1210
Ic = B. mask. chunks
0 commit comments