@@ -291,29 +291,46 @@ dec_kraus = KrausOperators(b_logical, b_fock, [dec_proj])
291291# @test avg_gate_fidelity(dec_kraus*enc_kraus) ≈ 1
292292# @test avg_gate_fidelity(ChoiState(dec_sup)*ChoiState(enc_sup)) ≈ 1
293293
294- # test amplitude damping channel
295- function amplitude_damp_kraus_op (b, κ, l)
296- γ = 1 - exp (- κ)
297- op = SparseOperator (b)
298- for n= l: (length (b)- 1 )
299- op. data[n- l+ 1 , n+ 1 ] = sqrt (binomial (n,l) * (1 - γ)^ (n- l) * γ^ l)
300- end
301- return op
294+ # test qubit amplitude and phase damping channels
295+ function ampl_damp_kraus (γ)
296+ b = SpinBasis (1 // 2 )
297+ K0 = dm (spindown (b)) + sqrt (1 - γ)* dm (spinup (b))
298+ K1 = sqrt (γ)* sigmam (b)
299+ return KrausOperators (b,b,[K0, K1])
302300end
303301
304- function test_amplitude_damp_kraus_channel (N, κ, tol)
305- b = FockBasis (N)
306- super = exp (liouvillian (identityoperator (b), [destroy (b)]; rates= [κ]))
307- kraus = KrausOperators (b, b, [amplitude_damp_kraus_op (b, κ, i) for i= 0 : (N- 1 )])
302+ function phase_damp_kraus (γ)
303+ b = SpinBasis (1 // 2 )
304+ K0 = dm (spindown (b)) + sqrt (1 - γ)* dm (spinup (b))
305+ K1 = sqrt (γ)* dm (spinup (b))
306+ return KrausOperators (b,b,[K0, K1])
307+ end
308+
309+ function test_channel (κa, κp)
310+ tol = 1e-7
311+ b = SpinBasis (1 // 2 )
312+ La = liouvillian (identityoperator (b), [sigmam (b)]; rates= [κa])
313+ Lp = liouvillian (identityoperator (b), [sigmaz (b)]; rates= [κp])
314+ super = exp (La + Lp)
315+ ka = ampl_damp_kraus (1 - exp (- κa))
316+ kp = phase_damp_kraus (1 - exp (- 4 * κp))
317+ kraus = ka* kp
318+ @test is_cptp (super; tol= tol)
319+ @test is_cptp (kraus; tol= tol)
308320 @test isapprox (SuperOperator (kraus), super; atol= tol)
309321 @test isapprox (ChoiState (kraus), ChoiState (super); atol= tol)
310322 @test isapprox (kraus, KrausOperators (super; tol= tol); atol= tol)
311- @test is_cptp ( kraus; tol = tol)
323+ return kraus, super
312324end
313325
314- test_amplitude_damp_kraus_channel (10 , 0.1 , 1e-7 )
315- test_amplitude_damp_kraus_channel (20 , 0.1 , 1e-7 )
316- test_amplitude_damp_kraus_channel (10 , 0.01 , 1e-7 )
317- test_amplitude_damp_kraus_channel (20 , 0.01 , 1e-8 )
326+ test_channel (1e-1 , 0 )
327+ test_channel (1e-2 , 0 )
328+ test_channel (1e-3 , 0 )
329+ test_channel (0 , 1e-1 )
330+ test_channel (0 , 1e-2 )
331+ test_channel (0 , 1e-3 )
332+ test_channel (1e-1 , 1e-1 )
333+ test_channel (1e-2 , 1e-2 )
334+ test_channel (1e-3 , 1e-3 )
318335
319336end # testset
0 commit comments