[SciPy-user] band matrices in scipy?

Pietro Berkes p.berkes at biologie.hu-berlin.de
Mon May 26 04:34:34 EDT 2003


Hi,
I dont't know if I'm the most qualified person to answer but I'll try.

On Monday 19 May 2003 17:18, Arnd Baecker wrote:
> Hi,
>
> I tried to find out about the support for band matrices
> in scipy and was not successfull.
> I would be grateful about any advice
> concerning information on
> a) what routines are accessible from scipy for
>    the determination of eigenvalues and eigenvectors
>    of band matrices

As far as I know there are no routines for band matrices. As you say there are 
Lapack routines to handle those problems, but no python wrapper for them has 
been written: there is an infinite number of Lapack routines, and some of the 
wrapping work has to be done by hand. It is however fairly simple to write 
your own wrappers: you have to write a '.pyf' file that contains a 
description of all the routines you want to wrap and than run f2py to build a 
wrapping module ( take a look at the f2py documentation at 
http://cens.ioc.ee/projects/f2py2e/ ). It is important to point out that you 
need to wrap 4 functions for each Lapack routine (one for each type - real, 
double, complex, double complex) and than have a python function that chooses 
which one it has to call (by the way, I seem to remember that this is what 
the 'get_lapack_funcs' function does).

> b) more importantly: how could I have found this myself?

It would have been difficult. SciPy is in quick development and (as a 
consequence) it lacks of documentation. I think the point is that the main 
developers have too much to do with more important things, while the common 
user finds it difficult to submit documentation patches. Could someone post 
some guidelines about this? Maybe we could organize a wiki page where to 
collect new documentation.

>
> Below I attach how I tried to find out about this.
> Either I am doing something in the wrong way,
> or the documentation needs some work in this
> direction (if so, maybe I can contribute a few lines on this).
>
> Many thanks,
>
> Arnd
>
>
>
> Here is what I tried. Comments are with #
>
> In [1]: import scipy
> In [2]: scipy.info(scipy)
> # so linalg seems to be the right one to look further:
> scipy.info(scipy.linalg)
> # However, here I don't find anything which looks like
> # it can deal with band matrices
> #
> # However, a
> In [3]: help(scipy.linalg)
> # gives a bit more:
> PACKAGE CONTENTS
>     __cvs_version__
>     __init__
>     _flinalg
>     basic
>     blas
>     calc_lwork
>     cblas
>     clapack
>     decomp
>     fblas
>     flapack
>     flinalg
>     interface_gen
>     lapack
>     linalg_version
>     matfuncs
>     setup_atlas_version
>     setup_linalg
>
> # At this point I am basically lost within scipy
> (I also did not manage to figure out if get_lapack_funcs
> from scipy.linalg.lapack
> could help me ...)
>
> Now I found from the lapack documentation
>   (on debian all this is under /usr/share/doc/lapack-doc/lug/node72.html
>    when lapack-doc is installed; also the corresponding man pages
>    are available)
> that SSBEV looks like the right routine
> (man SSBEV starts with:
>
> NAME
>        SSBEV  - compute all the eigenvalues and, optionally, eigenvectors
> of a
>        real symmetric band matrix A
>
> SYNOPSIS
>        SUBROUTINE SSBEV( JOBZ, UPLO, N, KD, AB, LDAB, W, Z, LDZ, WORK,
> INFO )
>
>            CHARACTER     JOBZ, UPLO
>
>            INTEGER       INFO, KD, LDAB, LDZ, N
>
>            REAL          AB( LDAB, * ), W( * ), WORK( * ), Z( LDZ, * )
> [...]
> )
>
> However, now I finally failed: I could not
> find this routine in any of the
>   scipy.linalg.lapack
>   scipy.linalg.lapack.flapack
>   scipy.linalg.lapack.clapack
>
> Any help is appreciated!
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list