[Numpy-discussion] ufunc for sum of squared difference

Matthew Harrigan harrigan.matthew at gmail.com
Wed Nov 16 20:18:34 EST 2016

Thanks for pointing me to that.  I think its a great match for a 1D case,
like the inner product of two arrays in terms of signature.  I don't see
how it works with higher dimensional arrays, esp with something like the
axis parameter in ufunc.reduce.  With what I proposed for an array of shape
(M, N) for example, result.shape could be (1,) or (M, 1) or (1, N) for
reducing over the flattened array or either axis.  Can you do something
like that with gufunc or do you need to iterate gufunc calls over
slices/views?  Thanks again.

On Mon, Nov 14, 2016 at 8:49 PM, Stephan Hoyer <shoyer at gmail.com> wrote:

> On Mon, Nov 14, 2016 at 5:40 PM, Matthew Harrigan <
> harrigan.matthew at gmail.com> wrote:
>> Essentially it creates a reduce for a function which isn't binary.  I
>> think this would be generally useful.
> NumPy already has a generic enough interface for creating such ufuncs. In
> fact, it's called a "generalized ufunc":
> https://docs.scipy.org/doc/numpy/reference/c-api.generalized-ufuncs.html
> I think you could already write "implicit reductions" using gufuncs?
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20161116/7d9d28b9/attachment.html>

More information about the NumPy-Discussion mailing list