@@ -759,8 +759,8 @@ julia> string.(("one","two","three","four"), ": ", 1:4)
759
759
broadcast (f:: Tf , As... ) where {Tf} = materialize (broadcasted (f, As... ))
760
760
761
761
# special cases defined for performance
762
- @inline broadcast (f, x:: Number... ) = f (x... )
763
- @inline broadcast (f, t:: NTuple{N,Any} , ts:: Vararg{NTuple{N,Any}} ) where {N} = map (f, t, ts... )
762
+ broadcast (f, x:: Number... ) = f (x... )
763
+ broadcast (f, t:: NTuple{N,Any} , ts:: Vararg{NTuple{N,Any}} ) where {N} = map (f, t, ts... )
764
764
765
765
"""
766
766
broadcast!(f, dest, As...)
@@ -818,23 +818,23 @@ end
818
818
819
819
Take a lazy `Broadcasted` object and compute the result
820
820
"""
821
- @inline materialize (bc:: Broadcasted ) = copy (instantiate (bc))
821
+ materialize (bc:: Broadcasted ) = copy (instantiate (bc))
822
822
materialize (x) = x
823
- @inline function materialize! (dest, bc:: Broadcasted{Style} ) where {Style}
823
+ function materialize! (dest, bc:: Broadcasted{Style} ) where {Style}
824
824
return copyto! (dest, instantiate (Broadcasted {Style} (bc. f, bc. args, axes (dest))))
825
825
end
826
- @inline function materialize! (dest, x)
826
+ function materialize! (dest, x)
827
827
return copyto! (dest, instantiate (Broadcasted (identity, (x,), axes (dest))))
828
828
end
829
829
830
830
# # general `copy` methods
831
- @inline copy (bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = bc[CartesianIndex ()]
831
+ copy (bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = bc[CartesianIndex ()]
832
832
copy (bc:: Broadcasted{<:Union{Nothing,Unknown}} ) =
833
833
throw (ArgumentError (" broadcasting requires an assigned BroadcastStyle" ))
834
834
835
835
const NonleafHandlingStyles = Union{DefaultArrayStyle,ArrayConflict}
836
836
837
- @inline function copy (bc:: Broadcasted{Style} ) where {Style}
837
+ function copy (bc:: Broadcasted{Style} ) where {Style}
838
838
ElType = combine_eltypes (bc. f, bc. args)
839
839
if Base. isconcretetype (ElType)
840
840
# We can trust it and defer to the simpler `copyto!`
@@ -862,10 +862,10 @@ end
862
862
# # general `copyto!` methods
863
863
# The most general method falls back to a method that replaces Style->Nothing
864
864
# This permits specialization on typeof(dest) without introducing ambiguities
865
- @inline copyto! (dest:: AbstractArray , bc:: Broadcasted ) = copyto! (dest, convert (Broadcasted{Nothing}, bc))
865
+ copyto! (dest:: AbstractArray , bc:: Broadcasted ) = copyto! (dest, convert (Broadcasted{Nothing}, bc))
866
866
867
867
# Performance optimization for the common identity scalar case: dest .= val
868
- @inline function copyto! (dest:: AbstractArray , bc:: Broadcasted{<:AbstractArrayStyle{0}} )
868
+ function copyto! (dest:: AbstractArray , bc:: Broadcasted{<:AbstractArrayStyle{0}} )
869
869
# Typically, we must independently execute bc for every storage location in `dest`, but:
870
870
# IF we're in the common no-op identity case with no nested args (like `dest .= val`),
871
871
if bc. f === identity && bc. args isa Tuple{Any} && isflat (bc)
@@ -897,7 +897,7 @@ preprocess_args(dest, args::Tuple{Any}) = (preprocess(dest, args[1]),)
897
897
preprocess_args (dest, args:: Tuple{} ) = ()
898
898
899
899
# Specialize this method if all you want to do is specialize on typeof(dest)
900
- @inline function copyto! (dest:: AbstractArray , bc:: Broadcasted{Nothing} )
900
+ function copyto! (dest:: AbstractArray , bc:: Broadcasted{Nothing} )
901
901
axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
902
902
# Performance optimization: broadcast!(identity, dest, A) is equivalent to copyto!(dest, A) if indices match
903
903
if bc. f === identity && bc. args isa Tuple{AbstractArray} # only a single input argument to broadcast!
915
915
916
916
# Performance optimization: for BitArray outputs, we cache the result
917
917
# in a "small" Vector{Bool}, and then copy in chunks into the output
918
- @inline function copyto! (dest:: BitArray , bc:: Broadcasted{Nothing} )
918
+ function copyto! (dest:: BitArray , bc:: Broadcasted{Nothing} )
919
919
axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
920
920
ischunkedbroadcast (dest, bc) && return chunkedcopyto! (dest, bc)
921
921
length (dest) < 256 && return invoke (copyto!, Tuple{AbstractArray, Broadcasted{Nothing}}, dest, bc)
@@ -971,7 +971,7 @@ liftchunks(args::Tuple{<:Bool,Vararg{Any}}) = (ifelse(args[1], typemax(UInt64),
971
971
ithchunk (i) = ()
972
972
Base. @propagate_inbounds ithchunk (i, c:: Vector{UInt64} , args... ) = (c[i], ithchunk (i, args... )... )
973
973
Base. @propagate_inbounds ithchunk (i, b:: UInt64 , args... ) = (b, ithchunk (i, args... )... )
974
- @inline function chunkedcopyto! (dest:: BitArray , bc:: Broadcasted )
974
+ function chunkedcopyto! (dest:: BitArray , bc:: Broadcasted )
975
975
isempty (dest) && return dest
976
976
f = flatten (liftfuncs (bc))
977
977
args = liftchunks (f. args)
@@ -1018,7 +1018,7 @@ end
1018
1018
1019
1019
# # Tuple methods
1020
1020
1021
- @inline function copy (bc:: Broadcasted{Style{Tuple}} )
1021
+ function copy (bc:: Broadcasted{Style{Tuple}} )
1022
1022
dim = axes (bc)
1023
1023
length (dim) == 1 || throw (DimensionMismatch (" tuple only supports one dimension" ))
1024
1024
N = length (dim[1 ])
@@ -1102,15 +1102,15 @@ struct BitMaskedBitArray{N,M}
1102
1102
mask:: BitArray{M}
1103
1103
BitMaskedBitArray {N,M} (parent, mask) where {N,M} = new (parent, mask)
1104
1104
end
1105
- @inline function BitMaskedBitArray (parent:: BitArray{N} , mask:: BitArray{M} ) where {N,M}
1105
+ function BitMaskedBitArray (parent:: BitArray{N} , mask:: BitArray{M} ) where {N,M}
1106
1106
@boundscheck checkbounds (parent, mask)
1107
1107
BitMaskedBitArray {N,M} (parent, mask)
1108
1108
end
1109
1109
Base. @propagate_inbounds dotview (B:: BitArray , i:: BitArray ) = BitMaskedBitArray (B, i)
1110
1110
Base. show (io:: IO , B:: BitMaskedBitArray ) = foreach (arg-> show (io, arg), (typeof (B), (B. parent, B. mask)))
1111
1111
# Override materialize! to prevent the BitMaskedBitArray from escaping to an overrideable method
1112
- @inline materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}} ) = fill! (B, bc. args[1 ])
1113
- @inline materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any} ) = materialize! (SubArray (B. parent, to_indices (B. parent, (B. mask,))), bc)
1112
+ materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}} ) = fill! (B, bc. args[1 ])
1113
+ materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any} ) = materialize! (SubArray (B. parent, to_indices (B. parent, (B. mask,))), bc)
1114
1114
function Base. fill! (B:: BitMaskedBitArray , b:: Bool )
1115
1115
Bc = B. parent. chunks
1116
1116
Ic = B. mask. chunks
0 commit comments