[SciPy-User] polylogarithm?

Johann Cohen-Tanugi johann.cohen-tanugi@lupm.univ-montp2...
Thu Sep 22 15:51:39 CDT 2011


Hello, I made some progress on cython, but I would like to clone 
test_lambertw.py in order to create unittests for my polylog code. The 
problem is that I do not manage to run it directly :
In [1]: from scipy.special._testutils import FuncData
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/cohen/sources/python/scipydev/<ipython-input-1-bf9da3823634> in 
<module>()
----> 1 from scipy.special._testutils import FuncData

ImportError: No module named _testutils

In [2]: from scipy.special import lambertw

In [4]: run ../pyvault/scipy-git/scipy/special/tests/test_lambertw.py
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/cohen/sources/python/pyvault/scipy-git/scipy/special/tests/test_lambertw.py 
in <module>()
      12 from numpy import nan, inf, pi, e, isnan, log, r_, array, complex_
      13
---> 14 from scipy.special._testutils import FuncData
      15
      16

ImportError: No module named _testutils

I have a master checkout of scipy from the git repository. What is the 
correct way to run this?
thanks in advance,
Johann

On 09/19/2011 03:55 PM, Pauli Virtanen wrote:
> Mon, 19 Sep 2011 15:42:52 +0200, Johann Cohen-Tanugi wrote:
> [clip]
>> where the first one is the mpmath code without the mpmath ctx objects
>> invoked, the second is the cython version, and the third is the mpmath
>> native version (0.17). Before I dive into cython management of arrays in
>> order for polylog to accept input arrays, I would appreciate feedback on
>> where to look for potential further improvements using cython, if any,
>> on a simplistic script as this one.
> In short:
>
> - Check the annotated HTML output from "cython -a".
>    The name of the game is to make things less yellow.
>
> - Add cdef type for all variables (removes PyObject boxing).
>    This will be the main source of speed gains.
>
> - Sprinkle in @cython.cdivision(True)
>
> - Use "from libc.math cimport abs"
>
> - Take a look at lambertw.pyx in scipy.special.
>    It shows you how to make the function an ufunc.
>


More information about the SciPy-User mailing list