[SciPy-User] Calling LAPACK function dbdsqr()?
Fri Dec 14 09:43:52 CST 2012
On Dec 14, 2012, at 10:38 AM, Jonathan Helmus wrote:
> 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,
> 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 : from ctypes import *
> In : import scipy.linalg
> In : lib = CDLL(scipy.linalg.lapack.clapack.__file__)
> In : lib.dbdsqr
> Out: <_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.
Awesome! Believe me, this is ideal compared to the alternatives.
Your code also works on my OS X install using scipy 0.11. It doesn't work under Linux Mint 13 w/scipy 0.9.0 nor WinXP w/scipy 0.10.0.
What's odd is that the latest source code for scipy only has one reference to this function, and it is documentation saying "Not Implemented". I'll have to experiment a little to see if this is coming to scipy via numpy.
Thank you so much, Jonathan. And for nmrglue, too ;)
More information about the SciPy-User