Source Code for a Program that Calculates the Eigenvalues Only of a Real Symmetric Matrix

The C++ source code posted at the link below is for a program that calculates the eigenvalues only of a real symmetric matrix. The algorithm is a translated--and heavily-edited--version of the EISPACK subprogram RS.F.


Smith, B.T.; J.M. Boyle; J.J. Dongarra; B.S. Garbow; Y. Ikebe; V.C. Klema; and C.B. Moler.
          "Matrix Eigensystem Routines--(EISPACK) Guide"
          Springer-Verlag, Berlin.

Garbow, B.S.; J.M. Boyle; J.J. Dongarra; and C.B. Moler.
          "Matrix Eigensystem Routines--(EISPACK) Guide Extension"
          Springer-Verlag, Berlin.

The original sub-routines were written in FORTRAN and have been translated to C++ here. Although all care has been taken to ensure that the sub-routines were translated accurately, some errors may have crept into the translation. These errors are mine; the original FORTRAN routines have been thoroughly tested and work properly. Please report any errors to the webmaster.


1) RS.F is a subprogram that offers users the option of calculating eigenavalues only, or eigenvalues AND eigenvectors. In the first case, RS.F calls subroutines TRED1 and TQL1; in the second case, RS.F calls subroutines TRED2 and TQL2. For the present program, TRED1 and TQL1 were coded into the main program but not translated into independent sub-routines. Their positions within the program are indicated within the comments.

2) TRED2 and TQL2 were not translated into the present program.
In addition, variables declared within RS.F, solely for use with TRED2 and TQL2, are omitted.

TRED1 reduces a real symmetric matrix to a symmetric tridiagonal matrix using orthogonal similarity transformations.
It is a translation of the algol procedure tred1, num. math. 11, 181-195(1968) by martin, reinsch, and wilkinson. handbook for auto. comp., vol.ii-linear algebra, 212-226(1971).

TQL1 finds the eigenvalues of a symmetric tridiagonal matrix by the ql method.
It is a translation of the algol procedure tql1, num. math. 11, 293-306(1968) by bowdler, martin, reinsch, and wilkinson. handbook for auto. comp., vol.ii-linear algebra, 227-240(1971).

C++ Source Code - Version 0
Version 0 incorporates some features specific to Microsoft's Visual C++ Version 6, which I believe are not standards-compliant.

C++ Source Code - Version 1
Version 1 uses a more standards-compliant approach to memory management, but is still awkward coding.

C++ Source Code - Version 2
Version 2 incorporates up-to-date, standards-compliant, coding, including the use of <vector> class.

Return to Math Functions Page

Return to Thothworks Home Page