[Numpy-discussion] Best way to broadcast a function from C

Nathaniel Smith njs at pobox.com
Fri Aug 22 21:42:52 EDT 2014


On Sat, Aug 23, 2014 at 12:40 AM, James Crist <crist042 at umn.edu> wrote:
> I suspected as much. This is actually part of my work on numerical
> evaluation in SymPy. In its current state compilation to C and autowrapping
> *works*, but I think it could definitely be more versatile/efficient. Since
> numpy seemed to have solved the broadcasting/datatype issues internally I
> hoped I could reuse this.
>
> I'll look into nditer (as this is for a library, it's better to do it
> *right* than do it now), but right now it's looking like I may need to
> implement this functionality myself...

Ah, I see. Right, if this isn't a one-off for some specific project
then disregard my advice from before :-).

nditer might be perfect -- or might not. If you figure it out then
we'd certainly appreciate any additions to the docs that you feel up
to contributing!

And similarly, we'd be happy to merge any enhancements you come up
with back into numpy itself, e.g. to allow gufunc signatures to handle
fixed-size output arrays. (This would also be useful for other cases,
e.g. np.cross, which is currently not a gufunc but it would be nice if
it were...)

-n

-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org



More information about the NumPy-Discussion mailing list