[Numpy-discussion] Allowing broadcasting of code dimensions in generalized ufuncs

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Thu May 31 16:14:02 EDT 2018


>
> I am -1 on multiple signatures. We may revisit this in time, but for now I
> find the minimal intrusiveness of the current changes appealing, especially
> as it requires few to no changes whatsoever to the inner loop function.
> Multiple dispatch could easily break that model by allowing very different
> signatures to be aggregated into a single ufunc, leading to unhandled edge
> cases and strange segfaults. It also seems to me that looping over all
> signatures might slow down ufunc calling, leading to endless variations of
> strategies of optimizing signature ordering.


I had actually started trying Allan's suggestion [1], and at least parsing
is not difficult. But I will stop now, as I think your point about the
inner loop really needing a fixed set of sizes and strides is deadly for
the whole idea. (Just goes to show I should think before writing code!)

As is, all the proposed changes do is fiddle with size 1 axes (well, and
defining a fixed size rather than letting the operand do it), which of
course doesn't matter for the inner loop.

-- Marten

[1]
https://github.com/numpy/numpy/compare/master...mhvk:gufunc-multiple-dispatch?expand=1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180531/9d1fc9d5/attachment-0001.html>


More information about the NumPy-Discussion mailing list