[Numpy-discussion] Possible to use numexpr with user made ufuncs/scipy ufuncs?

Francesc Alted faltet@pytables....
Mon Jun 28 02:48:42 CDT 2010

A Saturday 26 June 2010 19:17:43 Pauli Virtanen escrigué:
> But what if such an expression does not exist? For example, there is no
> finite closed form expression for the Bessel functions in terms of
> elementary functions. An accurate implementation is rather complicated,
> and usually piecewise defined.
> For convenience reasons, it could be useful if one could do something like
>     numexpr.evaluate("cos(iv(0, x))", functions=dict(iv=scipy.special.iv))
> and this would be translated to numexpr bytecode that would make a Python
> function call to obtain "iv(0, x)" for each block of data required,
> assuming "iv" is a vectorized function. It's of course possible to
> precompute the value of "iv(0, x)", but this is extra hassle and requires
> additional memory.

Yeah, I can see the merit of implementing such a thing, mainly for avoiding 
additional memory consumption.

But again, the nice thing would be to implement such a special functions in 
terms of numexpr expressions so that the evaluation itself can be faster.  
Admittedly, that would take a bit more time.

Anyway, if someone comes with patches for implementing this, I'd glad to 
commit them.
Francesc Alted

More information about the NumPy-Discussion mailing list