From e994ac943114cb89e56e208e945855cae43171f4 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 15 Sep 2015 13:57:15 -0400 Subject: [PATCH] fix #13144, elementwise min and max for > 3 array arguments (cherry picked from commit 94487c583c23df65fcf31f482804ee03a0186339) --- base/operators.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/base/operators.jl b/base/operators.jl index c2eb8ae900844..ad7e66213b9b3 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -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