[Numpy-discussion] ufunc for user-defined type
Travis E. Oliphant
oliphant@enthought....
Fri Feb 22 10:01:08 CST 2008
Neal Becker wrote:
> Now that I have my user-defined type, I want to add some funcs.
> According to the numpy book, I need to use:
>
> PyUFunc_RegisterLoopForType
>
> The book says I first need a ufunc. The only way I see to create one is
>
> PyUFunc_FromFuncAndData.
>
> Is the the correct procedure?
>
You'll have to do some digging because the API allowing low-level loops
for user-defined types is not well tested or vetted. Also, don't be
surprised if you uncover some bugs.
The concept is that you create the UFunc with the "built-in" types using
PyUFunc_FromFuncAndData and then you add loops for the user-defined type
using RegisterLoopForType.
So, you have the basic procedure down.
-Travis
More information about the Numpy-discussion
mailing list