In the following code, the function maxstar is applied along the
last axis. Can anyone suggest how to modify this to apply reduction along
a user-specified axis?
def maxstar2 (a, b):
return max (a, b) + log1p (exp (-abs (a - b)))
def maxstar (u):
s = u.shape[-1]
if s == 1:
return u[...,0]
elif s == 2:
return maxstar2 (u[...,0], u[...,1])
else:
return maxstar2 (
maxstar (u[...,:s/2]),
maxstar (u[...,s/2:]))
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion