I wrote a Lanczos eigenvalue solver for my large sparse symmetric matrices. After some step in the algorithm, I have to solve some reduced symmetric dense generalized eigenvalue problems.

I have some problems using Lapack driver routine dsygvd if I use this routine I can find the eigenvalues correctly but my eigenvectors are not right. I guess with the driver routines I do not need a backtransformation so they give the eigenvectors of the original problem.

I am calling the Lapack routines from C++. Now the problem is that if I use the code for a symmetric problem example as given in the NAG example pages. It works correctly. However, my matrices are not that simple as given in the examples of NAG. Let me rephrase, now due to the theory of the Lanczos computations,

AX = lambda BX

is reduced to a matrix pairs, A' and B' on the reduced problem level, so I have a reduced problem as such

A'z = lambda' B' z

where A' is in theory an identity matrix and B' is a symmetric tridiagonal of reduced dimensions depending on the size of the projection basis used to generate A' or B'.

Numerically, A' and B' have off-diagonal terms of very small orders, 1e-16 or smaller, using dsygvd here runs into problems with the eigenvector computation however eigenvalues are correct. I also tried to zero out these small entries but that did not help. I am now suspecting if I am using the routines correctly or not?