@@ -333,3 +333,45 @@ let A = [1. 0. 0.; 0. 0. 0.; 0. 0. 0.]
333
333
@test U' U ≈ I
334
334
@test V' V ≈ I
335
335
end
336
+
337
+ # Problematic example from #118
338
+ @testset " issue 118" begin
339
+ ωc = 1.2
340
+ ωa = 0.9
341
+ γ = 0.5
342
+ κ = 1.1
343
+
344
+ sz = sparse (ComplexF64[1 0 ; 0 - 1 ])
345
+ sp = sparse (ComplexF64[0 1 ; 0 0 ])
346
+ sm = sparse (collect (sp' ))
347
+ ids = one (sz)
348
+
349
+ a = sparse (diagm (1 => ComplexF64[sqrt (i) for i= 1 : 10 ]))
350
+ ida = one (a)
351
+
352
+ Ha = kron (ida, 0.5 * ωa* sz)
353
+ Hc = kron (ωc* a' * a, ids)
354
+ Hint = sparse (kron (a' , sm) + kron (a, sp))
355
+ H = Ha + Hc + Hint
356
+
357
+ Ja = kron (ida, sqrt (γ)* sm)
358
+ Jc = kron (sqrt (κ)* a, ids)
359
+ J = sqrt (2 ) .* [Ja, Jc]
360
+ Jdagger = adjoint .(J)
361
+ rates = 0.5 .* ones (length (J))
362
+
363
+ spre (x) = kron (one (x), x)
364
+ spost (x) = kron (permutedims (x), one (x))
365
+
366
+ L = spre (- 1im * H) + spost (1im * H)
367
+ for i= 1 : length (J)
368
+ jdagger_j = rates[i]/ 2 * Jdagger[i]* J[i]
369
+ L -= spre (jdagger_j) + spost (jdagger_j)
370
+ L += spre (rates[i]* J[i]) * spost (Jdagger[i])
371
+ end
372
+
373
+ for _= 1 : 100
374
+ d, rest = eigs (L, nev= 2 , which= :LR )
375
+ @test abs (d[1 ]) < 1e-9
376
+ end
377
+ end
0 commit comments