The goal of this project is to solve a “very large” generalized eigenvalue problem in a “reasonable” amount of time using library functions. The mass and stiffness matrices may be either dense or sparse. Optimum routines are desired for each case.

Here is description of the libraries and packages

gcc – GNU Compiler Collection for C/C++

BLAS – Basic Linear Algebra Subprograms

CBLAS – C interface to the BLAS

LAPACK – Linear Algebra PACKage. LAPACK is a software library for numerical linear algebra including the generalized eigenvalue problem. It uses BLAS.

PETSc – Portable, Extensible Toolkit for Scientific Computation. PETSc is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations. It includes a large suite of parallel linear and nonlinear equation solvers that are easily used in application codes written in C, C++, Fortran and now Python.

SLEPc – a software library for the parallel computation of eigenvalues and eigenvectors of large, sparse matrices. It can be seen as a module of PETSc that provides solvers for different types of eigenproblems, including linear (standard and generalized) and quadratic, as well as the SVD.

Note that PETSc/SLEPc requires BLAS/LAPACK.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Installation Steps:

I have a PC with Ubuntu 11.10 running with the gnome-classic shell.

I have installed the following:

Code::Blocks with the gcc compiler from the Ubuntu Software Center

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

BLAS

Step 1: download

$ wget http://www.netlib.org/blas/blas.tgz

Step 2: extraction

$ tar zxf blas.tgz this will create a directory BLAS

Step 3: compilation

$ cd BLAS

$ make all

If everything was correct in the previous step, your library is in the BLAS directory, called blas_LINUX.a

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CBLAS

Installation instructions:

BLAS must be installed first.

Next,

wget http://www.netlib.org/blas/blast-forum/cblas.tgz

tar zxf cblas.tgz

Go to CBLAS folder.

Open Makefiles.in in a text editor.

Modify this line in Makefiles.in

BLLIB = (specify path)/BLAS/blas_LINUX.a

make all

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

LAPACK

Step 1: download

$ wget http://www.netlib.org/lapack/lapack.tgz

Step 2: extraction

$ tar zxf lapack.tgz this will create a directory lapack.

Step 3: compilation

$ cd lapack-3.3.1

The configuration can be done in the make.inc.example file:

modify: BLASLIB = /directory/where/to/find/BLAS/blas$(PLAT).a

The LaPack library uses the BLAS library, so you need to tell where to find it. The result is a library lapack_LINUX.a: this can be copied in a place of your choice.

Save file as: make.inc

$ sudo apt-get install cmake (if not installed already)

$ cmake

$ make

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

BLAS/LAPACK

The following step may also be needed:

$ sudo apt-get install libblas-dev liblapack-dev

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

The C++ source code for the generalized eigenvalue program is given at:

gen_eigen.cpp (right mouse click & save target or link)

The header files are: dsygv.h dsyev.h cblas.h

The source code uses BLAS, CBLAS & LAPACK.

The following linker options are required:

-lgfortran

-lblas

-llapack

* * * * * * * * *

Here is another C++ version: gen_eig.cpp

The program can be compiled via:

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

* * *

Matlab scripts are given at:

Matlab Linear Algebra Page

* * *

A future generalized eigenvalue problem code will use PETSC & SLEPc. These packages can be downloaded via:

PETSc

sudo apt-get install petsc-dev

SLEPc

sudo apt-get install slepc3.1-dev

* * *

Python is well-suited for the generalized eigenvalue problem. It has functions derived from LAPACK. It also has functions for sparse systems using ARPACK. Sample scripts are posted at:

Vibrationdata Python Generalized Eigenvalue

* * *

Tom Irvine

### Like this:

Like Loading...