Sorry for the late reply. I had a chance to look into this, and you are
correct that your matrix causes GSL nonsymmv to fail.
In fact, if you check the return value of gsl_eigen_nonsymmv() it will
be 11, or GSL_EMAXITER, meaning the solver failed to find all
eigenvalues within the allotted number of iterations. In this case,
according to the documentation, the eigenvectors are not even computed,
so the eigenvectors you printed out are just garbage.
The eigenvalue solver failed to converge, most likely because your
matrix is ill-conditioned and the entries vary wildly in magnitude, and
the double-shift algorithm was unable to find appropriate shifts to
break off a new eigenvalue block. The LAPACK library uses a more
sophisticated algorithm than the GSL which is able to handle your
matrix, so I'd recommend using that for these types of matrices. In the
mean time, I'll try tinkering with the shift calculation to see if GSL
can be improved to work with this type of matrix.
Thanks for the report and as a future note, always check the return
value of gsl_eigen_nonsymmv() to tell immediately if there was a
convergence problem.
Patrick
On 11/13/2012 01:07 PM, Youna Hu wrote:
Hi, there:
I was using *gsl_eigen_nonsymmv *to get the eigenvalue decomposition of the
matrix in the attached file but found that the result is not right. Theory
says that there is an eigenvalue with value 1.0 and the corresponding
eigenvectors should be real. I've also tested this in the package R.
Could you please check? Thanks,
Youna
*Eigenvalue decompositon result from R:*
eigen(a)$values
[1] 1.000000e+00 1.110223e-16 -2.691078e-17 -1.540744e-33
-1.022873e-48
[6] -3.798227e-64 9.041170e-80 -4.313994e-112 1.043900e-127
2.451083e-129
[11] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00
[16] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00
[21] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00
[26] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00
[31] 0.000000e+00
eigen(a)$vectors[,1]
[1] -0.1796053 -0.1796053 -0.1796053 -0.1796053 -0.1796053 -0.1796053
-0.1796053
[8] -0.1796053 -0.1796053 -0.1796053 -0.1796053 -0.1796053 -0.1796053
-0.1796053
[15] -0.1796053 -0.1796053 -0.1796053 -0.1796053 -0.1796053 -0.1796053
-0.1796053
[22] -0.1796053 -0.1796053 -0.1796053 -0.1796053 -0.1796053 -0.1796053
-0.1796053
[29] -0.1796053 -0.1796053 -0.1796053
*EigenValue decomposition from GSL:*
eigenvalue[0] = 1.00000000000000066613 + 0.00000000000000000000 i
eigenvalue[1] = -0.00000000000000003534 + 0.00000000000000000000 i
eigenvalue[2] = 0.00000000000000000413 + 0.00000000000000000000 i
eigenvalue[3] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[4] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[5] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[6] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[7] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[8] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[9] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[10] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[11] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[12] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[13] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[14] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[15] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[16] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[17] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[18] = -0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[19] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[20] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[21] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[22] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[23] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[24] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[25] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[26] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[27] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[28] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[29] = 0.00000000000000000000 + 0.00000000000000000000 i
eigenvalue[30] = 0.00000000000000000000 + 0.00000000000000000000 i
*The eigenvectors:*
The eigenvector [0] = 0,0
The eigenvector [1] = 0.158848,-0.000727072
The eigenvector [2] = 2.0093e-07,-9.19685e-10
The eigenvector [3] = 1.87534e-06,-8.58373e-09
The eigenvector [4] = 1.26586e-05,-5.79402e-08
The eigenvector [5] = 6.58246e-05,-3.01289e-07
The eigenvector [6] = 0.000274269,-1.25537e-06
The eigenvector [7] = 0.000940351,-4.30413e-06
The eigenvector [8] = 0.00270351,-1.23744e-05
The eigenvector [9] = 0.00660858,-3.02484e-05
The eigenvector [10] = 0.013878,-6.35217e-05
The eigenvector [11] = 0.0252328,-0.000115494
The eigenvector [12] = 0.0399519,-0.000182866
The eigenvector [13] = 0.055318,-0.000253199
The eigenvector [14] = 0.0671718,-0.000307455
The eigenvector [15] = 0.0716499,-0.000327952
The eigenvector [16] = 0.0671718,-0.000307455
The eigenvector [17] = 0.055318,-0.000253199
The eigenvector [18] = 0.0399519,-0.000182866
The eigenvector [19] = -0.974767,-0.000115494
The eigenvector [20] = 0.013878,0.025667
The eigenvector [21] = 0.00660858,0.0349227
The eigenvector [22] = 0.00270351,-1.15514e-05
The eigenvector [23] = 0.000940351,-0.625902
The eigenvector [24] = 0.000274269,0.262268
The eigenvector [25] = 6.58244e-05,0.65909
The eigenvector [26] = 1.26585e-05,1.9919e-05
The eigenvector [27] = 1.87525e-06,0.351666
The eigenvector [28] = 2.0093e-07,-9.19685e-10
The eigenvector [29] = 1.38572e-08,-6.34266e-11
The eigenvector [30] = 4.61907e-10,-2.11422e-12