Tred2, tqli


lep
03-21-2009, 12:21 AM
When using TQLI to obtain eigenvectors and eigenvalues, is it correct to send matrix A from TRED2 to TQLI. The NM book states that if you are only seeking eigenvalues to set A to the identity matrix, and otherwise send A from TRED2 to TQLI for both eigenvectors and eigenvalues. I can't seem to replicate results from MATLAB for a real square symmetric matrix that has no zero elements. The MATLAB results agree with the online Bluebit results but not TQLI after TRED2(?)

DavidB
03-21-2009, 11:44 PM
You don't seem to have the right sequence (did you make a typo when making this post?).

The sub-routines you mention come from the EISPACK library of routines, specifically, RS.F:

Real-Symmetric Routine (http://www.netlib.org/eispack/rs.f)

If you want eigenvalues only, the variable matz is set to 0, in which case the routines tred1, tqlrat, and tql1 are called.

If you want eigenvalues and eigenvectors, the variable matz is given a non-zero integer value, in which case the routines tred2 and tql2 are called.

I do not see a path from tred2 to tql1.

And if you are setting A to the Identity matrix, how can the algorithm compute the eigenvalues and eigenvectors of YOUR matrix? (I am curious, what is your matrix?)

I believe the Bluebit routine you mention is based on the later LINPACK routines (written after the EISPACK routines and intended to incorporate some improvements into the algorithms).

I think MATLAB is based on the LINPACK routines, with some additional improvements.

lep
03-24-2009, 12:03 AM
David, my inquiry is about use of the TRED2 and TQLI subroutines that appear (published and described) in Numerical Recipes (fortran and C++ versions). Aren't codes in the Numerical Recipes books what this forum is for? Trying to understand - thx LP :confused:

lep
03-24-2009, 12:06 AM
It looks like someone else asked a similar question about eigenvector problems using tred2 then tqli in the post:

http://www.numerical-recipes.com/forum/showthread.php?p=1647

DavidB
03-24-2009, 02:01 PM
David, my inquiry is about use of the TRED2 and TQLI subroutines that appear (published and described) in Numerical Recipes (fortran and C++ versions). Aren't codes in the Numerical Recipes books what this forum is for? Trying to understand - thx LP :confused:

Hi, lep.

The section on eigensystems relies heavily on code from the EISPACK library and references it quite a bit, so I usually go right to EISPACK.

However, upon taking a second look, you are correct, NR (I am using the First Edition, page 362) indicates that TQLI can be called after TRED2.

Puzzling, if you look at the EISPACK listing, there is no TQLI but there is a TQL1 and TQL2:

EISPACK Listing (http://www.netlib.org/eispack/)

In addition, both TQL1 and TQL2 are written for Tridiagonal matrices. Your matrix isn't tridiagonal.

(I am curious: what is your matrix?)

The fact that you got the same results from MATLAB and Bluebit would indicate to me that you should trust those results. (Perhaps NR is mistaken in its use of these two routines.)

lep
03-25-2009, 11:49 PM
Matrix is a 10 x 10 full rank, non-singular, real-symmetric matrix with no structural zeroes.

I'll go through the EISPACK codes and make sure everything checks out ok. Thx