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

Stephan Hoyer shoyer at gmail.com
Wed May 30 19:22:36 EDT 2018


On Wed, May 30, 2018 at 11:15 AM Marten van Kerkwijk <
m.h.vankerkwijk at gmail.com> wrote:

> My PR provides the ability to indicate in the signature that a core
> dimension can be broadcast, by using a suffix of "|1". Thus, the
> signature of `all_equal` would become:
>
> ```
> (n|1),(n|1)->()
> ```
>

I read this as "dimensions may have size n or 1", which would exclude the
possibility of scalars.

For all_equal, I think you could also use a signature like "(m?),(n?)->()",
with a short-cut to automatically return False if m != n.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180530/c9af6ff1/attachment.html>


More information about the NumPy-Discussion mailing list