Permalink
Browse files

ENH: special: Merge PR #333

Replace the manually written _cephesmodule.c / _logit.c / *.pyx ufunc
definitions by automatic ones, generated from a concise description.

Docstrings are moved to a separate Python file, which is used on
autogeneration-time.

The autogeneration generates the wrappers in Cython --- this allows easier
integration of Cython code (removes the need to add new bloated modules for
each one, plus manual boilerplate).
  • Loading branch information...
2 parents 217067d + 8923ef1 commit 2ff729ffd52a256d6eb43699859d00805db8633c @pv pv committed Oct 18, 2012
Showing with 24,841 additions and 19,253 deletions.
  1. +2 −2 .gitattributes
  2. +0 −6 scipy/special/INSTALL
  3. +8 −17 scipy/special/SConscript
  4. +2 −6 scipy/special/__init__.py
  5. +0 −1,177 scipy/special/_cephesmodule.c
  6. +9 −93 scipy/special/_faddeeva.cxx
  7. +3 −0 scipy/special/_faddeeva.pxd
  8. +11 −137 scipy/special/_logit.c.src
  9. +14 −0 scipy/special/_logit.h
  10. +18,173 −0 scipy/special/_ufuncs.c
  11. +4,185 −0 scipy/special/_ufuncs_cxx.cxx
  12. +1,190 −47 scipy/special/add_newdocs.py
  13. +44 −44 scipy/special/amos_wrappers.c
  14. +15 −15 scipy/special/amos_wrappers.h
  15. +13 −3 scipy/special/basic.py
  16. +9 −15 scipy/special/bento.info
  17. +1 −1 scipy/special/bscript
  18. +0 −96 scipy/special/cephes/tempout.txt
  19. +0 −194 scipy/special/cephes_doc.h
  20. +0 −5,847 scipy/special/docs/cephes.txt
  21. +0 −18 scipy/special/docs/cephestest.py
  22. +0 −740 scipy/special/docs/included_functions.html
  23. +0 −461 scipy/special/docs/included_functions.html.orig
  24. +0 −43 scipy/special/gendoc.py
  25. +743 −0 scipy/special/generate_ufuncs.py
  26. +0 −2,774 scipy/special/lambertw.c
  27. +148 −0 scipy/special/lambertw.pxd
  28. +152 −0 scipy/special/lambertw.py
  29. +0 −343 scipy/special/lambertw.pyx
  30. +1 −1 scipy/special/orthogonal.py
  31. +0 −6,327 scipy/special/orthogonal_eval.c
  32. +36 −0 scipy/special/orthogonal_eval.pxd
  33. +6 −77 scipy/special/{orthogonal_eval.pyx → orthogonal_eval.py}
  34. +22 −33 scipy/special/setup.py
  35. +38 −38 scipy/special/specfun_wrappers.c
  36. +13 −13 scipy/special/specfun_wrappers.h
  37. +0 −7 scipy/special/special_version.py
  38. +3 −3 scipy/special/tests/test_basic.py
  39. +0 −593 scipy/special/ufunc_extras.c
  40. +0 −82 scipy/special/ufunc_extras.h
View
@@ -17,7 +17,7 @@ scipy/sparse/csgraph/_tools.c binary
scipy/sparse/csgraph/_traversal.c binary
scipy/spatial/ckdtree.c binary
scipy/spatial/qhull.c binary
-scipy/special/lambertw.c binary
-scipy/special/orthogonal_eval.c binary
+scipy/special/_ufuncs.c binary
+scipy/special/_ufuncs_cxx.cxx binary
scipy/stats/_rank.c binary
scipy/stats/vonmises_cython.c binary
@@ -1,6 +0,0 @@
-1. Make sure cephes/mconf.h file is correct (see README).
-2. Make sure amos/d1mach.f and amos/i1mach.f is correct for your machine.
-3. Check the makefile in cephes/ and amos/ for your system.
-4. Compile the libraries libcephes.a and libamos.a
-5. Check the Makefile in the main directory and adjust for your system.
-6. Run the Makefile with make.
@@ -85,29 +85,20 @@ env.MergeFlags(math_info.cflags())
env.MergeFlags(math_info.libs())
env.PrependUnique(LIBPATH = ['.'])
-# orthogonal_eval extension
-env.NumpyPythonExtension('orthogonal_eval', source = 'orthogonal_eval.c')
+# Ufuncs extension
+src = ['_ufuncs.c', 'amos_wrappers.c', 'specfun_wrappers.c', \
+ 'toms_wrappers.c','cdf_wrappers.c','ufunc_extras.c',
+ '_logit.c.src']
-# logit extension
-logit_src = env.GenerateFromTemplate('_logit.c.src')
-env.NumpyPythonExtension('_logit', source = logit_src)
+src_cxx = ['_ufuncs_cxx.cxx', '_faddeeva.cxx', 'faddeeva_w.cxx']
-# faddeeva extension
-env.NumpyPythonExtension('_faddeeva', source=['_faddeeva.cxx',
- 'faddeeva_w.cxx'])
-
-# lambertw extension
-env.NumpyPythonExtension('lambertw', source = 'lambertw.c')
-
-# Cephes extension
-src = ['_cephesmodule.c', 'amos_wrappers.c', 'specfun_wrappers.c', \
- 'cdf_wrappers.c','ufunc_extras.c']
-
-env.NumpyPythonExtension('_cephes',
+env.NumpyPythonExtension('_ufuncs',
source = src,
LIBS = ['sc_amos', 'sc_c_misc', 'sc_cephes', 'sc_mach',\
'sc_cdf', 'sc_specfunlib'])
+env.NumpyPythonExtension('_ufuncs_cxx', source = src_cxx)
+
# Specfun extension
env.Prepend(LIBS = ['sc_specfunlib'])
env.NumpyPythonExtension('specfun', source = 'specfun.pyf',
@@ -520,19 +520,15 @@ class also has an attribute ``weights`` which returns the roots, weights,
"""
-#from special_version import special_version as __version__
-
-from _cephes import *
+from _ufuncs import *
+from _ufuncs_cxx import *
from basic import *
import specfun
import orthogonal
from orthogonal import *
from spfun_stats import multigammaln
from lambertw import lambertw
-from _logit import logit, expit
-from _faddeeva import wofz
-import add_newdocs
__all__ = filter(lambda s:not s.startswith('_'),dir())
Oops, something went wrong.

0 comments on commit 2ff729f

Please sign in to comment.