News
11.02.2009: | The symeig routine is integrated in the
0.7 release of SciPy. It is
available there as scipy.linalg.eigh
with a slightly different signature. The module described in this page
is obsolete!
|
Old Description
Symeig - Symmetrical eigenvalue routines for NumPy
The symeig module contains a Python wrapper for the LAPACK functions to solve the standard and generalized eigenvalue problems for symmetric and hermitian matrices. Those specialized algorithms give an important speed-up with respect to the generic LAPACK eigenvalue problem solver used by NumPy (linalg.eig
and linalg.eigh
).
The wrapper function symeig
automatically selects the
appropriate LAPACK routine. It is also possible to request only a
subset of all eigenvalues, which consumes less memory and
results sometimes in an additional speed-up, especially for large matrices.
Installation
- Requirements:
- Download: Download symeig at SourceForge
- Installation:
Unpack the archive file and enter the project directory.
To build the module type:
python setup.py build
To install it:
python setup.py install
If you want to use symeig without installing it on the system Python path:
python setup.py install --prefix=/some_dir_in_your_PYTHONPATH/
- Testing:
Check your installation in a Python shell as follows:
>>> import symeig >>> symeig.test()
Mantainers
symeig has been written by Pietro Berkes and Tiziano Zito at the Institute for Theoretical Biology of the Humboldt University, Berlin.For comments, patches, feature requests, support requests, and bug reports please send a message to the MDP users mailing list.
Documentation
- symeig docstring:
"""Solve standard and generalized eigenvalue problem for symmetric and hermitian matrices. Syntax: w,Z = symeig(A) w = symeig(A,eigenvectors=0) w,Z = symeig(A,range=(lo,hi)) w,Z = symeig(A,B,range=(lo,hi)) Inputs: A -- An N x N real symmetric or complex hermitian matrix. B -- An N x N real symmetric or complex hermitian definite positive matrix. eigenvectors -- if set return eigenvalues and eigenvectors, otherwise only eigenvalues turbo -- (only for generalized eigenvalue problem and if range=None) if turbo = "on", use divide and conquer algorithm (faster but expensive in memory) range -- the tuple (lo,hi) represent the indexes of the smallest and largest (in ascending order) eigenvalues to be returned. 1 <= lo < hi <= N if range = None, returns all eigenvalues and eigenvectors. type -- (only for generalized eigenvalue problem) Specifies the problem type to be solved: type = 1: A*x = (lambda)*B*x = 2: A*B*x = (lambda)*x = 3: B*A*x = (lambda)*x overwrite -- if 'overwrite' is set, computations are done inplace, A and B are overwritten during calculation (you save memory but loose the matrices). If matrices are complex this argument is ignored. Outputs: w -- (selected) eigenvalues in ascending order. Z -- if range = None, Z contains the matrix of eigenvectors, normalized as follows: Z^H * A * Z = lambda and - type = 1 or 2: Z^H * B * Z = I - type = 3 : Z^H * B^(-1) * Z = I where ^H means conjugate transpose. if range, an N x M matrix containing the orthonormal eigenvectors of the matrix A corresponding to the selected eigenvalues, with the i-th column of Z holding the eigenvector associated with w[i]. The eigenvectors are normalized as above. """
- Wrapped LAPACK functions:
symeig wraps the following LAPACK functions for standard and generalized symmetric eigenvalue problems:EVR routines ssyevr.f
dsyevr.f
cheevr.f
zheevr.f
GV routines ssygv.f
dsygv.f
chegv.f
zhegv.f
GVD routines ssygvd.f
dsygvd.f
chegvd.f
zhegvd.f
GVX routines ssygvx.f
dsygvx.f
chegvx.f
zhegvx.f