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

Allan Haldane allanhaldane at gmail.com
Thu May 31 16:17:54 EDT 2018


On 05/31/2018 04:14 PM, Marten van Kerkwijk wrote:
>     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.

Yes, after seeing how complicated some of the signatures become, I think
I'm more convinced the custom syntax is better.

Allan


More information about the NumPy-Discussion mailing list