I am going to solve

A B X=E X

where A and B are both tridiagonal matrixs, X is a vector, E the eigenvalue. According to my problem, one eigenvalue is zero and other eigenvalues must be positive. However, NOT all the numerical eigenvalues are positive!

In my project, B is positve definite, while A is not positive definite. The diagonal elements of A and B are not quite small, while subdiagonal and superdiagonal elments are quite samll (~10^-5). I first factorize B using DPOTRF, second reduce the problem to a standard problem using DSYGST, then I use DSYTRD, finally I use DSTEBZ to get all the eigenvalues. I have tested my subroutine of solving generalized eigen problems using some other A and B, and found the the subroutine is correct. However, when I used the form of A and B in my problem, I cannot get the correct answer. Is it due to the fact that the sub- and super- diagonal elements in my problem is small so that numerical error is quite large in the calculation.