[SciPy-dev] Extensions linking to libraries used by numpy/scipy

Tom Loredo loredo at astro.cornell.edu
Sun Mar 5 19:08:36 CST 2006


Hi folks,

I asked about this some time ago and was told there was no 
straightforward way to accomplish it, but that was over a
year ago and before the recent numpy/scipy split, etc..  So
I thought I'd ask again.

I'm writing a package with several C and Fortran extensions,
some of which call functions or subroutines that do things
already done by Scipy routines, e.g., evaluate a gamma function,
perform an LU decomposition, etc..  There are repeated calls,
in the course of a more complex calculation, and the most
sensible way to do the calculations would be to call Scipy's library
routines directly, and not go back through Python.  In some cases as 
a placeholder I have a version derived from Numerical Recipes, and 
this is a no-no as far as public distribution is concerned.  I'd like
to be able to call & link to the C or Fortran libraries that Scipy
is accessing, but I need to do it in a way that will build
and operate reliably across the various platforms Scipy builds on.

As specific examples, I'd like to access functions in
cephes/gamma.c, and lapack routines for LU decomposition
and determinant calcuation, e.g., DGETRF, DGBTRF or DGTTRF.

I suspect this isn't hard for gamma.c, but since Scipy 
is sometimes built with BLAS/LAPACK, and sometimes with ATLAS,
I suspect it's harder for the LU decomposition.

So... is there a way to do this portably?  If so, is it
documented somewhere (example code and an example setup.py)?  
Are there examples I could look at?  Do some particular
Scipy modules provide good examples of this (which ones)?

Thanks for any pointers,
Tom


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/




More information about the Scipy-dev mailing list