lapack routine dsygv giving negative eigen values

Post here if you have a question about LAPACK or ScaLAPACK algorithm or data format

lapack routine dsygv giving negative eigen values

Postby rajithkr » Sun Mar 19, 2017 5:18 am

Hello,
just joined this forum as i got into a problem while using LAPACK routine (DSYGV). i am using fortran 95 for an eigen value analysis for type Ax=lamda B type problem. i am trying to get the eigen value using the routine, and it gives first two eigen values as -ve which is not expected. i ran previously on 5 similar models and i got the eigen values as expected.. what could be reason for this negative value in eigen value listing. I checked both matrices - A and B, they are square, symmetric and all the diagonal elements are positive elements in all 6 cases. i could upload the matrices if anyone wish to see them - they are 660 X660 matrices - around 11mb each in csv format. appreciate any guidance here.
rajithkr
 
Posts: 2
Joined: Sun Mar 19, 2017 3:48 am

Re: lapack routine dsygv giving negative eigen values

Postby rajithkr » Tue Mar 21, 2017 2:07 am

Hello,
just joined this forum as i got into a problem while using LAPACK routine (DSYGV). i am using fortran 95 for an eigen value analysis for type Ax=lamda B type problem. i am trying to get the eigen value using the routine, and it gives first two eigen values as -ve which is not expected. i ran previously on 5 similar models and i got the eigen values as expected.. what could be reason for this negative value in eigen value listing. I checked both matrices - A and B, they are square, symmetric and all the diagonal elements are positive elements in all 6 cases. i could upload the matrices if anyone wish to see them - they are 660 X660 matrices - around 11mb each in csv format. appreciate any guidance here. I took out the matrices A and B into Mathcad and checked for cholesky decomposition and Eigen values, they work well and gave Eigen values as what is expected. upon comparing the Eigen listing in Mathcad and dsygv listing, I found the following.
eigen value(3) in dsygv was matching eigenval(1) of mathcad, eigenval(4) was matching eigenval(2) of mathcad and so on.. looks like the 2 negative values got inserted in the listing - attached is the screenshot. could some one explain why this is happening
comparison.JPG
comparison.JPG (163.11 KiB) Viewed 257 times
rajithkr
 
Posts: 2
Joined: Sun Mar 19, 2017 3:48 am

Re: lapack routine dsygv giving negative eigen values

Postby resultant » Tue Mar 28, 2017 12:03 am

If you can compute Cholesky decomposition of A and B, both A and B are positive definite matrices.
In the case, we should use dggsvd3.f as follows,
Cholesky decomposition A=CA^{T} CA
Cholesky decomposition B=CB^{T} CB
and compute Generalized Singular Value Decomposition(GSVD) for CA and CB.
We can regard GSVD as (CA^{T} CA) v = \lambda (CB^{T} CB) v, where CA and CB are general matrices.
From the result of GSVD, we can obtain eigenvalues of (CA^{T} CA) v = \lambda (CB^{T} CB) v, easily.
However, eigenvectors are not trivial.
Please see http://www.netlib.org/lapack/lug/node36.html.
Last edited by resultant on Wed Mar 29, 2017 6:24 am, edited 1 time in total.
resultant
 
Posts: 12
Joined: Fri Nov 13, 2015 9:35 am

Re: lapack routine dsygv giving negative eigen values

Postby resultant » Tue Mar 28, 2017 10:43 am

Instead of Cholesky decomposition, we can use Cholesky decomposition with pivoting.

Maybe, dggsvd3.f has bug.
However, we can obtain the solution using another approach.
Computing SVD(CA*CB^(-1))=U*Sigma*V^{T}
Since CB is upper triangular matrix, CA*CB^(-1) can be computed easily.
Sigma^2 is eigen values and CB^(-1)*V is eigen vectors.
From the same reason, CB^(-1)*V can be computed easily.
resultant
 
Posts: 12
Joined: Fri Nov 13, 2015 9:35 am


Return to Algorithm / Data

Who is online

Users browsing this forum: No registered users and 2 guests