Utilities

The Python scripts on this page require the utility modules

tompy.py

transfer_modes.py

* * *

Primary Method

A script for calculating the eigenvalues and vectors for a mass and stiffness matrix system is given at: gen_eig.py

The script uses the following functions:

*from scipy.linalg import eig, eigh*

The references for these functions are:

eig

eigh

They provide an interface to the LAPACK routines dgeev and zgeev. These routines implement the QR method with Householder reflectors.

* * *

Sparse Matrices

Here is a script for find a subset of the lowest eigenvalues and vectors for a sparse system: gen_eig_sparse.py

The scripts uses the functions:

*from scipy.sparse.linalg import eigsh*

*from scipy.sparse.linalg import eigs*

It also uses these functions in shift-inverted mode to find the lowest eigenvalues with speed and accuracy.

Reference: Sparse Eigenvalue Problems with ARPACK

* * *

Alternate Method

Another method is to use the Locally Optimal Block Preconditioned Conjugate Gradient Method (LOBPCG).

*from scipy.sparse.linalg import lobpcg*

But there are anecdotal reports that this method is inaccurate in some cases.

* * *

Fortran

Here is a pure Fortran program for the generalized eigenvalue problem: geigen.f.

The program can be compiled via:

$ gfortran -o geigen geigen.f -lblas -llapack

The program uses LAPACK routines DSYGV and DSYEV.

* * *

C/C++

Here is C/C++ program for the generalized eigenvalue problem: gen_eig.cpp.

The program can be compiled via:

gcc -o gen_eig gen_eig.cpp -lblas -llapack -lstdc++

* * *

Scilab

A Scilab program is given at: generalized_eigen_read.sci

* * *

Related Posts

Mixed Fortran & Python – Gives an example using the generalized eigenvalue problem

Vibrationdata Blog Entry – Instructions for the generalized eigenvalue problem including Lapack installation.

* * *

– Tom Irvine