[Numpy-discussion] ufuncs for structured arrays
Mon Oct 1 22:32:05 CDT 2012
Cool idea! I like to see work on structured arrays. Just a couple of
- Since there are already have ufuncs for primitive dtypes (int, float,
etc), and you are just acting columnwise here, can't you write a single
function which interprets the dtypes, gathers the approriate scalar ufuncs,
and applies those down each field? Yes registering individual functions
using your mechanism will be faster, but it will also be more work.
- I didn't try this out myself, but will the normal numpy broadcasting
rules apply here?
On Mon, Oct 1, 2012 at 10:36 AM, Jay Bourque <email@example.com>wrote:
> I've submitted the following pull request for NumPy:
> This change allows ufuncs to be registered for structured arrays by using
> a new API method PyUFunc_RegisterLoopForStructType. For example, a ufunc
> could be registered to take two arrays of type 'u8,u8,u8' and return an
> array of type 'u8,u8,u8'. I have a trivial example of this included in my
> pull request, along with further details of my changes. I suspect there
> might be a better way to do this, so any suggestions for improvements would
> be welcome.
> NumPy-Discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion