[SciPy-dev] Lambert W implementation

Yosef Meller mellerf@netvision.net...
Sat Nov 7 07:52:05 CST 2009

ציטוט Pauli Virtanen:
> It's faster to make it a Ufunc -- np.vectorize will likely sacrifice 
> much of the speed gained from using Cython since it's going to box and unbox
> numbers in Python floats. There's an example how to do Ufuncs in
> Cython here:
> 	http://projects.scipy.org/scipy/browser/trunk/scipy/special/orthogonal_eval.pyx

Thanks for the example, it really helped.

> If you get it done, please post the result (preferably, create
> a ticket on http://projects.scipy.org/scipy/ and attach the file) and
> we'll integrate it in scipy.special. If you also write tests, that'd
> be great!

Here it is, with the tests:

The doc-string is not exactly in the doc format of SciPy, but I don't 
have time to work on it right now.

> Note that newer Cythons also have support for native complex numbers, so
> you can do
> 	cdef double complex a = ...
> The same algorithm probably works both for real and complex parameters.

Thanks. Took some hunting around to get all the complex machinery to 
work, but it's finally done.


More information about the Scipy-dev mailing list