LAPACK Archives

### [Lapack] question for developers

 ``` Hello, You are right Matlab's using LAPACK routine dsyev() to compute eigenvalues and eigenvectors of a symmetric matrix. The IMSL routine evcsf() is another routine dissociated from LAPACK a priori that computes eigenvalues and eigenvectors of a symmetric matrix. Be careful though Matlab by default will be double precision (dsyev) while IMSL evcsf is the single precision routine. Your symmetric matrix has simple eigenvalues. So all its eigenvectors are essentially unique. Essentially unique means that if you normalize an eigenvector associated to the eigenvalue lambda, then you have only two answers either x or -x. LAPACK routine dsyev() and IMSL routine evcsf() returns you normalized eigenvectors, but whether x_LAPACK = + x_IMSL or x_LAPACK = - x_IMSL is arbitrary. +x, -x are both correct answer and any routine is free to return the one it wants. (Well, and as you have noticed the eigenvalues are the same, hopefully,...) Good continuation in your work, -j On Wed, 6 Sep 2006, junejaja@Domain.Removed wrote: `````` Dear Sir/Madam, I am a Ph.D. student at the University of Arizona and in my research, I am computing eigenvectors for several countries bond yields. I used numerical fortran and matlab in my computations. To my understanding, matlab uses the Linear Algebra package (LAPACK) family of routines. I am a bit puzzled about my results, as I find them to be interesting, as may software developers. I post my results below. I used the built-in eig function for matlab, where i pass in a matrix and it gives me the matrix of eigenvectors and a diagonal matrix containing the eigenvalues. Matlab A = 4.5891 4.2818 3.8384 3.6000 3.3441 4.2818 4.1597 3.8264 3.6378 3.4315 3.8384 3.8264 3.5884 3.4451 3.2885 3.6000 3.6378 3.4451 3.3284 3.1966 3.3441 3.4315 3.2885 3.1966 3.0970 ``````[V,D]=eig(A) `````` V = 0.1090 0.0979 -0.4557 -0.7314 0.4857 -0.5256 -0.3244 0.5994 -0.1786 0.4768 0.7991 -0.0946 0.3513 0.1815 0.4428 -0.2225 0.8053 0.0085 0.3504 0.4233 -0.1543 -0.4771 -0.5563 0.5267 0.4019 D = 0.0012 0 0 0 0 0 0.0015 0 0 0 0 0 0.0136 0 0 0 0 0 0.5493 0 0 0 0 0 18.1970 For fortran, I computed eigenvectors using routines from the IMSL library of routines (I called the EVCSF routine). The results are shown below EVAL 1 2 3 4 5 18.20 0.55 0.01 0.00 0.00 EVEC 1 2 3 4 5 1 0.4857 0.7314 -0.4558 0.0979 0.1089 2 0.4768 0.1786 0.5994 -0.3245 -0.5255 3 0.4428 -0.1815 0.3513 -0.0946 0.7991 4 0.4233 -0.3504 0.0085 0.8053 -0.2225 5 0.4019 -0.5267 -0.5563 -0.4772 -0.1542 The principal components correspond to the eigenvalues with the highest value. The eigenvalues are the same across the two software packages, and so are the first, third, fourth, and fifth components. The second component, however, when computed in matlab is exactly the negative reciprocal, element-wise, of that obtained from running the EVCSF routine from IMSL numerical fortran. I also found that these results are systematic, i.e. they are not local to this data. I computed the eigenvectors for 3 other groups and noticed this same difference. Can you please advise? Thank You!! Yall have a nice night. Regards, Januj _______________________________________________ Lapack mailing list Lapack@Domain.Removed http://lists.cs.utk.edu/listinfo/lapack `````` ```
 Current Thread [Lapack] question for developers, junejaja at email.arizona.edu [Lapack] question for developers, Julien Langou <=

For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or