[Numpy-discussion] ufunc void *extra

Robert Kern robert.kern@gmail....
Sat Aug 22 20:26:28 CDT 2009

On Sat, Aug 22, 2009 at 18:15, Marty Fuhry<martyfuhry@gmail.com> wrote:
> The "Beyond the Basics" manual
> (http://docs.scipy.org/doc/numpy/user/c-info.beyond-basics.html)
> indicates that the generic ufunc loop (in this example loop1d) has a
> void* extra (or void* data) argument that can be used to pass extra
> data to the ufunc, but it doesn't indicate how to use this argument.
> Can anyone tell me how to use this extra argument? I'm trying to get a
> ufunc to perform a different operation by passing it a second
> parameter, but I'm not sure how to do this.
>>>> some_ufunc(narray, "A")
> will perform operation A on object narray
>>>> some_ufunc(narray, "B")
> will perform operation B on object narray
> Is this even a valid operation?

No. This is not configurable at call-time and certainly not from
Python. It is used only from the C level. In particular, it is used
for things like the ufuncs in scipy.special to configure the
(otherwise generic) ufuncs with the function pointer that does the
actual computation.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the NumPy-Discussion mailing list