if has_good_functions:
from numpy import logaddexp, logaddexp2
else:
logaddexp = vectorize(_logaddexp, otypes=[numpy.float64])
logaddexp2 = vectorize(_logaddexp2, otypes=[numpy.float64])
# Run these at least once so that .ufunc.reduce exists
logaddexp([1.,2.,3.],[1.,2.,3.])
logaddexp2([1.,2.,3.],[1.,2.,3.])
# And then make reduce available at the top level
logaddexp.reduce = logaddexp.ufunc.reduce
logaddexp2.reduce = logaddexp2.ufunc.reduce
The point was that I wanted to treat the output of vectorize as a hacky drop-in replacement for a ufunc. In 1.7, I discovered that vectorize had changed (
https://github.com/numpy/numpy/pull/290), and now there is no longer a ufunc attribute at all.
Should this be added back in? Besides hackish drop-in replacements, I see value in to being able to call reduce, accumulate, etc (when possible) on the output of vectorize().