Increase maximum iterations

This commit is contained in:
Nuwan Yapa 2026-05-07 12:43:44 -04:00
parent 7029fdaf56
commit e3545e4fbe
1 changed files with 2 additions and 1 deletions

View File

@ -125,6 +125,7 @@ function (H::Hamiltonian)(v)
end
tolerance = 1e-6
max_iterations = 500
"Wrapper for KrylovKit.eigsolve"
function eig(H::Hamiltonian{T}, levels::Int; resonances = !H.hermitian)::Tuple{Vector,Vector,KrylovKit.ConvergenceInfo} where {T<:Float}
@ -134,7 +135,7 @@ function eig(H::Hamiltonian{T}, levels::Int; resonances = !H.hermitian)::Tuple{V
x₀ = CUDA.rand(Complex{T}, vectorDims(H)...)
synchronize()
end
evals, evecs, info = eigsolve(H, x₀, levels, resonances ? :LI : :SR; ishermitian = H.hermitian, tol = tolerance, krylovdim = levels * 8)
evals, evecs, info = eigsolve(H, x₀, levels, resonances ? :LI : :SR; ishermitian = H.hermitian, tol = tolerance, krylovdim = levels * 8, maxiter = max_iterations)
info.converged < levels && throw(error("Not enough convergence"))
if H.hermitian evals = real.(evals) end
if H.mode == gpu_cutensor # to avoid possible GPU memory leak