-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Occasional LAPACKException(22)
in eigsolve
#57
Comments
Thanks for this detailed and reproducible bug report. Nonetheless, this is a difficult one to debug, because of the LAPACK error, which is outside of my own control. Even digging into the LAPACK documentation did not make me much wiser as to what this error code exactly indicates. Nonetheless, I do indeed assume that it has to do with the clustered structure of the eigenvalues as you point out. Perhaps an a not strongly related but nonetheless important note is that, theoretically speaking, Krylov methods cannot find degenerate eigenvalues. In principle, the starting vector (which in your case is chosen as a random vector by KrylovKit) has a particular component in each eigenspace, irrespective of its dimensionality, and Krylov methods than find ways to extract this individual components, which are thus eigenvectors of the matrix. However, this would be one eigenvector in every eigenspace, irrespective of that eigenspace being higher-dimensional. However, it's only because numerical precision introduces small errors in the orthonormalization process, that new, independent directions in higher-dimensional eigenspaces can be generated. But it is somewhat fragile to rely on this behaviour. But I assume that in your case these eigenvalues are not exactly degenerate? Nonetheless, this behaviour is indicative of the kind of issues that you might expect to encounter. I will do some further investigation, but I am afraid that I will not have an easy fix. |
Thank you for the detailed answer. The matrix in the above example does possess degenerate eigenvalues. We can make the MWE even more minimal by considering a matrix of only three non-zero bands: function test_krylov2(;b, N, n_j)
h = bm.BandedMatrix(bm.Zeros(2n_j + 1, 2n_j + 1), (N, N))
h[bm.band(0)] .= [j^2 for j = -n_j:n_j]
h[bm.band(-N)] .= h[bm.band(N)] .= b
kk.eigsolve(h, 80, :SR; krylovdim=90)
end
test_krylov2(b=1000, N=3, n_j=100) For Additionally, I have noticed that if one constructs a matrix of integers (e.g. using Anyway, thanks for the package! |
+1, stumbled on this issue too and took me a while to figure it out has it is randomly reproducible. I also had some degenerate eigenvalues. |
@yakovbraver @Jutho @gaspardbb I also encountered similar error in ExponentialUtilities.jl. May these info can help. See SciML/ExponentialUtilities.jl#171 |
Consider diagonalisation of a real symmetric matrix in the following MWE:
Approximately once in 20 runs,
eigsolve
tirggersLinearAlgebra.LAPACKException(22)
:When
eigsolve
does succeed, it always converges to the same result, which coincides with the one returned byLinearAlgebra.eigvals
. Perhaps the problem is caused by the groups (of size 2N) of very closely spaced eigenvalues of the constructed matrix.The problem shows up as well for e.g.,
krylovdim=40
(withhowmany=30
), provided we keep the matrix of the same size as in the example above (wheren_j=112
).Tested on Julia 1.7.2 and KrylovKit 0.5.4.
The text was updated successfully, but these errors were encountered: