Skip to content

Commit

Permalink
fix #13144, elementwise min and max for > 3 array arguments
Browse files Browse the repository at this point in the history
(cherry picked from commit 94487c5)
  • Loading branch information
JeffBezanson authored and tkelman committed Sep 15, 2015
1 parent cfb437a commit e994ac9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ function afoldl(op,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,qs...)
y
end

immutable ElementwiseMaxFun end
call(::ElementwiseMaxFun, x, y) = max(x,y)

immutable ElementwiseMinFun end
call(::ElementwiseMinFun, x, y) = min(x, y)

for (op,F) in ((:+,:(AddFun())), (:*,:(MulFun())), (:&,:(AndFun())), (:|,:(OrFun())),
(:$,:$), (:min,:(MinFun())), (:max,:(MaxFun())), (:kron,:kron))
(:$,:(XorFun())), (:min,:(ElementwiseMinFun())), (:max,:(ElementwiseMaxFun())), (:kron,:kron))
@eval begin
# note: these definitions must not cause a dispatch loop when +(a,b) is
# not defined, and must only try to call 2-argument definitions, so
Expand Down

0 comments on commit e994ac9

Please sign in to comment.