## 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

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

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 (163.11 KiB) Viewed 2665 times
rajithkr

Posts: 2
Joined: Sun Mar 19, 2017 3:48 am

### Re: lapack routine dsygv giving negative eigen values

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.
Last edited by resultant on Wed Mar 29, 2017 6:24 am, edited 1 time in total.
resultant

Posts: 13
Joined: Fri Nov 13, 2015 9:35 am

### Re: lapack routine dsygv giving negative eigen values

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: 13
Joined: Fri Nov 13, 2015 9:35 am
{"extraction_info": {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8892878890037537, "perplexity": 2317.8344767237263}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-43/segments/1570986654086.1/warc/CC-MAIN-20191014173924-20191014201424-00517.warc.gz"}