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

Philip Semanchuk philip@semanchuk....
Fri Dec 14 13:24:54 CST 2012

On Dec 14, 2012, at 11:47 AM, Pauli Virtanen wrote:

> Philip Semanchuk <philip <at> semanchuk.com> writes:
> [clip]
>>> CLAPACK is also abandonware, LAPACKE is the current C/C++ interface. 
>>> Thus with any recent LAPACK, there will be no clapack in SciPy.
>> Hmmm, well that's disappointing to hear, but better to know
>> now than finding out the hard way later. 
>> Maybe a pure-Python + numpy/scipy solution for this just
>> isn't possible right now. 
> However, you should still be able to use ctypes to interface with the
> Fortran routines in scipy/linalg/flapack.so
> While the CLAPACK is not always present, the Fortran-based LAPACK is.
> This may however require some fiddling with the calling conventions.
> So testing with multiple platforms will be needed, but perhaps you
> are OK with doing that...

Hmm, this just gets more and more interesting...

My Python code was already calling a compiled Fortran version of dbdsqr() via ctypes. (This version of dbdsqr() is in our custom library -- the one I'm porting -- and it's the only thing I haven't yet been able to port to Python.) Just now I was able to swap out the reference to our custom library and use Jonathan Helmus' technique to get a scipy reference to dbdsqr. All I changed was the library reference, and it worked! So now I'm totally independent of our compiled custom library under OS X. That's excellent news.

The not-so-excellent news is that on Windows I installed scipy 0.11.0 (the same version that's on my Mac) and it does *not* seem to provide a reference to dbdsqr(). I also looked for _dbdsqr, dbdsqr_, _dbdsqr_, etc. and it's just not there. I can get a reference to e.g. zgelss -- 

>>> hasattr(scipy.linalg.lapack.flapack, 'zgelss')

But not dbdsqr. I guess this is an artifact of the LAPACK library against which scipy was compiled?


More information about the SciPy-User mailing list