Skip to content

Commit

Permalink
Test with T1Decay and T2Dephasing
Browse files Browse the repository at this point in the history
  • Loading branch information
ba2tro committed Nov 1, 2023
1 parent acb2982 commit dd5da70
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions test/test_quantumchannel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ sref = regB.staterefs[1]
# the above code puts both the qubits of the state in the same register
@test sref.registers[1] == sref.registers[2]



## Test with the second constructor
bell = (Z1Z1 + Z2Z2)/sqrt(2.0)
regA = Register(2)
regB = Register(2)
Expand All @@ -59,4 +58,52 @@ run(sim)

sref = regB.staterefs[1]

@test sref.registers[1] == sref.registers[2]
@test sref.registers[1] == sref.registers[2]

## Test with T1Decay

bell = (Z1Z1 + Z2Z2)/sqrt(2.0)
regA = Register(2)
regB = Register(2)
initialize!((regA[1], regB[2]), bell)

sim = Simulation()

qc = QuantumChannel(sim, 10.0, T1Decay(0.1))

@resumable function alice_node(env, qc)
put!(qc, regA[1])
end

@resumable function bob_node(env, qc)
@yield @process take!(env, qc, regB[1])
end

@process alice_node(sim, qc)
@process bob_node(sim, qc)

run(sim)

## Test with T2Dephasing

bell = (Z1Z1 + Z2Z2)/sqrt(2.0)
regA = Register(2)
regB = Register(2)
initialize!((regA[1], regB[2]), bell)

sim = Simulation()

qc = QuantumChannel(sim, 10.0, T2Dephasing(0.1))

@resumable function alice_node(env, qc)
put!(qc, regA[1])
end

@resumable function bob_node(env, qc)
@yield @process take!(env, qc, regB[1])
end

@process alice_node(sim, qc)
@process bob_node(sim, qc)

run(sim)

0 comments on commit dd5da70

Please sign in to comment.