[Numpy-discussion] Future of ufuncs

Sebastian Berg sebastian at sipsolutions.net
Mon May 29 05:40:39 EDT 2017

On Sun, 2017-05-28 at 14:53 -0600, Charles R Harris wrote:
> Hi All,
> This post is to open a discussion of the future of ufuncs. There are
> two contradictory ideas that have floated about regarding ufuncs
> evolution. One is to generalize ufuncs to operate on buffers,
> essentially separating them from their current entanglement with
> ndarrays. The other is to accept that they are fundamentally part of
> the ndarray universe and move them into the multiarray module, thus
> avoiding the odd overloading of functions in the multiarray module.
> The first has been a long time proposal that I once thought sounded
> good, but I've come to prefer the second. That change of mind was
> driven by the resulting code simplification and the removal of a
> dependence on a Python feature, buffers, that we cannot easily modify
> to adapt to changing needs and new dtypes. Because I'd like to move
> the ufuncs, if we decide to move them, sometime after NumPy 1.14 is
> released, now seems a good time to decide the issue.
> Thoughts?

I did not think about it much. But I agree that the dtypes are probably
the biggest issue, also I am not sure anymore if there is much of a
gain on having ufuncs work on buffers in any case?

The dtype thing goes a bit back to ideas like the datashape things and
trying to make the dtypes somewhat separate from numpy? Though I doubt
I would want to make that an explicit goal.

I wonder how much of the C-loops and type resolving we could/should
expose? What I mean is that ufuncs are:

 * type resolving (somewhat ufunc specific)
 * outer loops (normal, reduce, etc.) using nditer (buffering)
 * inner 1d loops

It is a bit more complicating, but just wondering if it might make
sense to try and expose the individual ufunc things (type resolving and
1d loop) but not all the outer loop nditer setup which is ndarray
specific in any case (honestly, I am not sure it is entirely possible
it is already exposed).

- Sebastian

> Chuck
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170529/779e7347/attachment.sig>

More information about the NumPy-Discussion mailing list