[SciPy-dev] Re: Slicot library and scipy

Travis Oliphant oliphant at ee.byu.edu
Tue Sep 28 11:52:17 CDT 2004

Nils Wagner wrote:

> Dear Travis,
> As you encouraged me to learn f2py I would like to ask you,
> if you can help me with an interface for continuous and discrete Lyapunov
> equations as a starting point.  Once I know how to manage it in general,
> I would be glad to submit more slicot routines to scipy.

It looks like your problems are related to making sure SB03MD has the 
libraries it needs to run.   It looks like it needs a dummy SELECT 
function for DGEES (it actually never calls it but the interface 
requires it).

You also need to be sure that SB03MY and SB03MX and MB01RD are compiled 
and linked along with SB03MD (it calls them). 

I'm attaching a modified .pyf file that you could use and a util.f file 
with the SELECT function defined. 

You need to compile like this (assuming you have a libslicot.a placed in 

f2py -L<path-to-slicot> -lslicot -L<path-to-atlas> -llapack -lf77blas 
-latlas  -c slicot.pyf utils.f

This is the better way to do it and will allow you to grow slicot.pyf 
until you've made available all of the routines. 

You can start the process of wrapping all of the slicot library by 
letting f2py construct the basic .pyf file by going to the slicot src 
directory and doing

f2py -h slicot.pyf -m slicot *.f

This will give you a basic, raw interface to all of the slicot 
routines.  You will then want to edit the slicot.pyf file (like I did 
here for sb03md) to make the routine more useful --- hide some 
variables, show that some are input and some are output variables --- 
and so forth.

You will find along the way that f2py will fail to parse some of the 
SLICOT fortran routines.  Just don't include them in the list of 
routines to make an interface for.  I needed to move IB03AD.f  and 
IB03BD.f out of the way before running the command to get it to 
complete.   The resulting slicot.pyf file is huge and contains a very 
raw interface to the entire slicot library (minus those two routines --- 
I'm submitting a bug report to Pearu now). 

The slicot.pyf file can be compiled with f2py as before.  If you want to 
write a setup.py file you can (but that is another story).

> I am quite sure that many scipy users are interested in features 
> provided by
> the slicot library.
> What do you think ?

SLICOT would be a nice addition to SciPy.


I noticed that the SLICOT folks don't want people distributing SLICOT 
with their library, so it looks like only the interface could be 
distributed with SciPy and you would have to go and download the SLICOT 
tools from them, which is too bad unless some kind of agreement and 
separate license for SciPy could be obtained --- it looks like they 
mainly want credit, so in SciPy we could put in the help for the tools 
that if you use them you must credit them in a paper.

At any rate, perhaps the interface could be distributed and then a check 
made at compile time (by default off) to see if the library is already 
there then the interface could be built. 


> I look forward to heraring from you.
> Cheers,
>                   Nils

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: utils.f
Url: http://projects.scipy.org/pipermail/scipy-dev/attachments/20040928/c2827fb6/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: slicot.pyf
Url: http://projects.scipy.org/pipermail/scipy-dev/attachments/20040928/c2827fb6/attachment-0001.pl 

More information about the Scipy-dev mailing list