[SciPy-User] Calling LAPACK function dbdsqr()?

Jonathan Helmus jjhelmus@gmail....
Fri Dec 14 09:38:35 CST 2012


On 12/14/2012 09:34 AM, Philip Semanchuk wrote:
> Hi all,
> I'm porting some Fortran code that makes use of a number of BLAS and LAPACK functions, including dbdsqr(). I've found all of the functions I need via scipy.linalg.lapack.get_lapack_funcs/get_blas_funcs() except for dbdsqr().
>
> I see that the numpy source code (I looked at numpy-1.6.0b2) contains dbdsqr() in numpy/linalg/dlapack_lite.c, but grep can't find that string in the binary distribution on my Mac nor on Linux. If it's buried in a numpy binary somewhere, I'm comfortable with using ctypes to call it, but I suspect it isn't.
>
> Can anyone point me to a cross-platform (OS X, Linux&  Windows) way I can call this function without compiling code myself?
>
> I'm unfortunately quite naïve about the math in the code I'm porting, so I'm porting the code blindly -- if you ask me what problem I'm trying to solve with dbdsqr(), I won't be able to explain.
>
> Thanks in advance for any suggestions,
> Philip
Philip,

Not sure if this is portable or is possible on all or even most Scipy 
installs but I can find a pointer to the LAPACK dbdsqr function in the 
clapack/flapack shared library using ctypes on my EDP 7.3.1 rh5 install:


In [1]: from ctypes import *

In [2]: import scipy.linalg

In [3]: lib = CDLL(scipy.linalg.lapack.clapack.__file__)

In [4]: lib.dbdsqr
Out[4]: <_FuncPtr object at 0x2d306d0>

This also works with the scipy.linalg.lapack.flapack.__file__ and 
np.linalg.lapack_lite.__file__.  I would think it would be possible to 
create a Python wrapper around this with the ctypes module (>= Python 
2.5) which properly defines the arguments and returned types, etc but it 
is not ideal.

     Cheers,

     - Jonathan Helmus


More information about the SciPy-User mailing list