@@ -820,8 +820,8 @@ julia> string.(("one","two","three","four"), ": ", 1:4)
820
820
broadcast (f:: Tf , As... ) where {Tf} = materialize (broadcasted (f, As... ))
821
821
822
822
# special cases defined for performance
823
- @inline broadcast (f, x:: Number... ) = f (x... )
824
- @inline broadcast (f, t:: NTuple{N,Any} , ts:: Vararg{NTuple{N,Any}} ) where {N} = map (f, t, ts... )
823
+ broadcast (f, x:: Number... ) = f (x... )
824
+ broadcast (f, t:: NTuple{N,Any} , ts:: Vararg{NTuple{N,Any}} ) where {N} = map (f, t, ts... )
825
825
826
826
"""
827
827
broadcast!(f, dest, As...)
@@ -879,28 +879,28 @@ end
879
879
880
880
Take a lazy `Broadcasted` object and compute the result
881
881
"""
882
- @inline materialize (bc:: Broadcasted ) = copy (instantiate (bc))
882
+ materialize (bc:: Broadcasted ) = copy (instantiate (bc))
883
883
materialize (x) = x
884
884
885
- @inline function materialize! (dest, x)
885
+ function materialize! (dest, x)
886
886
return materialize! (dest, instantiate (Broadcasted (identity, (x,), axes (dest))))
887
887
end
888
888
889
- @inline function materialize! (dest, bc:: Broadcasted{Style} ) where {Style}
889
+ function materialize! (dest, bc:: Broadcasted{Style} ) where {Style}
890
890
return materialize! (combine_styles (dest, bc), dest, bc)
891
891
end
892
- @inline function materialize! (:: BroadcastStyle , dest, bc:: Broadcasted{Style} ) where {Style}
892
+ function materialize! (:: BroadcastStyle , dest, bc:: Broadcasted{Style} ) where {Style}
893
893
return copyto! (dest, instantiate (Broadcasted {Style} (bc. f, bc. args, axes (dest))))
894
894
end
895
895
896
896
# # general `copy` methods
897
- @inline copy (bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = bc[CartesianIndex ()]
897
+ copy (bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = bc[CartesianIndex ()]
898
898
copy (bc:: Broadcasted{<:Union{Nothing,Unknown}} ) =
899
899
throw (ArgumentError (" broadcasting requires an assigned BroadcastStyle" ))
900
900
901
901
const NonleafHandlingStyles = Union{DefaultArrayStyle,ArrayConflict}
902
902
903
- @inline function copy (bc:: Broadcasted{Style} ) where {Style}
903
+ function copy (bc:: Broadcasted{Style} ) where {Style}
904
904
ElType = combine_eltypes (bc. f, bc. args)
905
905
if Base. isconcretetype (ElType)
906
906
# We can trust it and defer to the simpler `copyto!`
@@ -932,10 +932,10 @@ end
932
932
# # general `copyto!` methods
933
933
# The most general method falls back to a method that replaces Style->Nothing
934
934
# This permits specialization on typeof(dest) without introducing ambiguities
935
- @inline copyto! (dest:: AbstractArray , bc:: Broadcasted ) = copyto! (dest, convert (Broadcasted{Nothing}, bc))
935
+ copyto! (dest:: AbstractArray , bc:: Broadcasted ) = copyto! (dest, convert (Broadcasted{Nothing}, bc))
936
936
937
937
# Performance optimization for the common identity scalar case: dest .= val
938
- @inline function copyto! (dest:: AbstractArray , bc:: Broadcasted{<:AbstractArrayStyle{0}} )
938
+ function copyto! (dest:: AbstractArray , bc:: Broadcasted{<:AbstractArrayStyle{0}} )
939
939
# Typically, we must independently execute bc for every storage location in `dest`, but:
940
940
# IF we're in the common no-op identity case with no nested args (like `dest .= val`),
941
941
if bc. f === identity && bc. args isa Tuple{Any} && isflat (bc)
@@ -967,7 +967,7 @@ preprocess_args(dest, args::Tuple{Any}) = (preprocess(dest, args[1]),)
967
967
preprocess_args (dest, args:: Tuple{} ) = ()
968
968
969
969
# Specialize this method if all you want to do is specialize on typeof(dest)
970
- @inline function copyto! (dest:: AbstractArray , bc:: Broadcasted{Nothing} )
970
+ function copyto! (dest:: AbstractArray , bc:: Broadcasted{Nothing} )
971
971
axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
972
972
# Performance optimization: broadcast!(identity, dest, A) is equivalent to copyto!(dest, A) if indices match
973
973
if bc. f === identity && bc. args isa Tuple{AbstractArray} # only a single input argument to broadcast!
987
987
988
988
# Performance optimization: for BitArray outputs, we cache the result
989
989
# in a "small" Vector{Bool}, and then copy in chunks into the output
990
- @inline function copyto! (dest:: BitArray , bc:: Broadcasted{Nothing} )
990
+ function copyto! (dest:: BitArray , bc:: Broadcasted{Nothing} )
991
991
axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
992
992
ischunkedbroadcast (dest, bc) && return chunkedcopyto! (dest, bc)
993
993
length (dest) < 256 && return invoke (copyto!, Tuple{AbstractArray, Broadcasted{Nothing}}, dest, bc)
@@ -1043,7 +1043,7 @@ liftchunks(args::Tuple{<:Bool,Vararg{Any}}) = (ifelse(args[1], typemax(UInt64),
1043
1043
ithchunk (i) = ()
1044
1044
Base. @propagate_inbounds ithchunk (i, c:: Vector{UInt64} , args... ) = (c[i], ithchunk (i, args... )... )
1045
1045
Base. @propagate_inbounds ithchunk (i, b:: UInt64 , args... ) = (b, ithchunk (i, args... )... )
1046
- @inline function chunkedcopyto! (dest:: BitArray , bc:: Broadcasted )
1046
+ function chunkedcopyto! (dest:: BitArray , bc:: Broadcasted )
1047
1047
isempty (dest) && return dest
1048
1048
f = flatten (liftfuncs (bc))
1049
1049
args = liftchunks (f. args)
@@ -1090,7 +1090,7 @@ end
1090
1090
1091
1091
# # Tuple methods
1092
1092
1093
- @inline function copy (bc:: Broadcasted{Style{Tuple}} )
1093
+ function copy (bc:: Broadcasted{Style{Tuple}} )
1094
1094
dim = axes (bc)
1095
1095
length (dim) == 1 || throw (DimensionMismatch (" tuple only supports one dimension" ))
1096
1096
N = length (dim[1 ])
@@ -1174,15 +1174,15 @@ struct BitMaskedBitArray{N,M}
1174
1174
mask:: BitArray{M}
1175
1175
BitMaskedBitArray {N,M} (parent, mask) where {N,M} = new (parent, mask)
1176
1176
end
1177
- @inline function BitMaskedBitArray (parent:: BitArray{N} , mask:: BitArray{M} ) where {N,M}
1177
+ function BitMaskedBitArray (parent:: BitArray{N} , mask:: BitArray{M} ) where {N,M}
1178
1178
@boundscheck checkbounds (parent, mask)
1179
1179
BitMaskedBitArray {N,M} (parent, mask)
1180
1180
end
1181
1181
Base. @propagate_inbounds dotview (B:: BitArray , i:: BitArray ) = BitMaskedBitArray (B, i)
1182
1182
Base. show (io:: IO , B:: BitMaskedBitArray ) = foreach (arg-> show (io, arg), (typeof (B), (B. parent, B. mask)))
1183
1183
# Override materialize! to prevent the BitMaskedBitArray from escaping to an overrideable method
1184
- @inline materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}} ) = fill! (B, bc. args[1 ])
1185
- @inline materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any} ) = materialize! (SubArray (B. parent, to_indices (B. parent, (B. mask,))), bc)
1184
+ materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}} ) = fill! (B, bc. args[1 ])
1185
+ materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any} ) = materialize! (SubArray (B. parent, to_indices (B. parent, (B. mask,))), bc)
1186
1186
function Base. fill! (B:: BitMaskedBitArray , b:: Bool )
1187
1187
Bc = B. parent. chunks
1188
1188
Ic = B. mask. chunks
0 commit comments