Hi!
When updating the version of Arpack in a package I noticed tests started to fail some of the time. The following code reproduces the issue. The test at the end fails on Arpack v0.5, but only on the first run. On later runs, it works. I apologize for the somewhat convoluted construction of matrices here, but whenever I tried to simplify the error no longer occurred.
using Arpack
using LinearAlgebra, SparseArrays, Random, Test
Random.seed!(0)
ωc = 1.2
ωa = 0.9
γ = 0.5
κ = 1.1
sz = sparse(ComplexF64[1 0; 0 -1])
sp = sparse(ComplexF64[0 1; 0 0])
sm = sparse(collect(sp'))
ids = one(sz)
a = sparse(diagm(1 => ComplexF64[sqrt(i) for i=1:10]))
ida = one(a)
Ha = kron(ida, 0.5*ωa*sz)
Hc = kron(ωc*a'*a, ids)
Hint = sparse(kron(a', sm) + kron(a, sp))
H = Ha + Hc + Hint
Ja = kron(ida, sqrt(γ)*sm)
Jc = kron(sqrt(κ)*a, ids)
J = sqrt(2) .* [Ja, Jc]
Jdagger = adjoint.(J);
rates = 0.5 .* ones(length(J))
spre(x) = kron(one(x), x)
spost(x) = kron(permutedims(x), one(x))
L = spre(-1im*H) + spost(1im*H)
for i=1:length(J)
jdagger_j = rates[i]/2*Jdagger[i]*J[i]
global L -= spre(jdagger_j) + spost(jdagger_j)
global L += spre(rates[i]*J[i]) * spost(Jdagger[i])
end
d, rest = eigs(L, nev=2, which=:LR)
@test abs(d[1]) < 1e-9
This worked fine on v0.4. Note that when using eigen(Matrix(L)) the eigenvalue with the largest real part is 0.
Version info:
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Hi!
When updating the version of Arpack in a package I noticed tests started to fail some of the time. The following code reproduces the issue. The test at the end fails on Arpack v0.5, but only on the first run. On later runs, it works. I apologize for the somewhat convoluted construction of matrices here, but whenever I tried to simplify the error no longer occurred.
This worked fine on v0.4. Note that when using
eigen(Matrix(L))the eigenvalue with the largest real part is 0.Version info: