@@ -26,7 +26,7 @@ function _mapreduce(f, opt, d::DArray)
26
26
end
27
27
reduce (opt, results)
28
28
end
29
- Base. mapreduce (f, opt:: Union{typeof(@functorize(|)) , typeof(@functorize(&) )} , d:: DArray ) = _mapreduce (f, opt, d)
29
+ Base. mapreduce (f, opt:: Union{typeof(|) , typeof(& )} , d:: DArray ) = _mapreduce (f, opt, d)
30
30
Base. mapreduce (f, opt:: Function , d:: DArray ) = _mapreduce (f, opt, d)
31
31
Base. mapreduce (f, opt, d:: DArray ) = _mapreduce (f, opt, d)
32
32
@@ -124,26 +124,25 @@ for (fn, fr) in ((:sum, :+),
124
124
(:minimum , :min ),
125
125
(:any , :| ),
126
126
(:all , :& ))
127
- @eval (Base.$ fn)(d:: DArray ) = reduce (@functorize ( $ fr) , d)
127
+ @eval (Base.$ fn)(d:: DArray ) = reduce ($ fr, d)
128
128
end
129
129
130
130
# mapreduce like
131
131
for (fn, fr1, fr2) in ((:maxabs , :abs , :max ),
132
132
(:minabs , :abs , :min ),
133
133
(:sumabs , :abs , :+ ),
134
134
(:sumabs2 , :abs2 , :+ ))
135
- @eval (Base.$ fn)(d:: DArray ) = mapreduce (@functorize ( $ fr1), @functorize ( $ fr2) , d)
135
+ @eval (Base.$ fn)(d:: DArray ) = mapreduce ($ fr1, $ fr2, d)
136
136
end
137
137
138
138
# semi mapreduce
139
139
for (fn, fr) in ((:any , :| ),
140
140
(:all , :& ),
141
141
(:count , :+ ))
142
142
@eval begin
143
- (Base.$ fn)(f:: typeof (@functorize (identity)), d:: DArray ) = mapreduce (f, @functorize ($ fr), d)
144
- (Base.$ fn)(f:: Base.Predicate , d:: DArray ) = mapreduce (f, @functorize ($ fr), d)
145
- # (Base.$fn)(f::Base.Func{1}, d::DArray) = mapreduce(f, @functorize $fr, d)
146
- (Base.$ fn)(f:: Callable , d:: DArray ) = mapreduce (f, @functorize ($ fr), d)
143
+ (Base.$ fn)(f:: typeof (identity), d:: DArray ) = mapreduce (f, $ fr, d)
144
+ (Base.$ fn)(f:: Base.Predicate{1} , d:: DArray ) = mapreduce (f, $ fr, d)
145
+ (Base.$ fn)(f:: Callable , d:: DArray ) = mapreduce (f, $ fr, d)
147
146
end
148
147
end
149
148
@@ -208,17 +207,17 @@ for f in (:+, :-, :div, :mod, :rem, :&, :|, :$)
208
207
B = samedist (A, B)
209
208
map_localparts ($ f, A, B)
210
209
end
211
- ($ f){T}(A:: DArray{T} , B:: Array{T} ) = ($ f)(A, distribute (B, A) )
212
- ($ f){T}(A:: Array{T} , B:: DArray{T} ) = ($ f)( distribute (A, B) , B)
210
+ ($ f){T}(A:: DArray{T} , B:: Array{T} ) = map_localparts ($ f, A, B )
211
+ ($ f){T}(A:: Array{T} , B:: DArray{T} ) = map_localparts ($ f, A , B)
213
212
end
214
213
end
215
214
for f in (:.+ , :.- , :.* , :./ , :.% , :.<< , :.>> )
216
215
@eval begin
217
216
function ($ f){T}(A:: DArray{T} , B:: DArray{T} )
218
217
map_localparts ($ f, A, B)
219
218
end
220
- ($ f){T}(A:: DArray{T} , B:: Array{T} ) = ($ f)(A, distribute (B, A) )
221
- ($ f){T}(A:: Array{T} , B:: DArray{T} ) = ($ f)( distribute (A, B) , B)
219
+ ($ f){T}(A:: DArray{T} , B:: Array{T} ) = map_localparts ($ f, A, B )
220
+ ($ f){T}(A:: Array{T} , B:: DArray{T} ) = map_localparts ($ f, A , B)
222
221
end
223
222
end
224
223
0 commit comments