Beispiel #1
0
 def generate_bell_pair(self):
     """Generate a raw Bell pair."""
     bell = errs.bell_pair(self.pn)
     return bell
Beispiel #2
0
# eta = (0.1)*(0.03)*(0.8)
# theta = .24

# Initialize  objects
cb = circuit_block.Blocks(ps, pm, pg, eta, a0, a1, theta)
cb_ideal = circuit_block.Blocks(0, 0, 0, 1, 0, 0, np.pi / 4.)
rho_ref = qt.bell_state('00') * qt.bell_state('00').dag()

print("------------------TEST SWAP--------------------------")
_, _, rho = cb.start_epl()
print("F initial: ", qt.fidelity(rho, rho_ref))
rho = cb._swap_pair(rho, [0, 1])
print("F: ", qt.fidelity(rho, rho_ref))

print("------------------SINGLE SELECTION-------------------")
rho = errs.bell_pair(0.1)
print("F initial: ", qt.fidelity(rho, rho_ref)**2)
rho = qt.tensor(rho, rho)
p, check, rho = cb_ideal.single_selection_ops(rho, [0, 1], [2, 3], "Z")
print("p_success: ", p, p_ref(0.9))
print("check: ", check)
print("F: ", qt.fidelity(rho, rho_ref)**2, single_selection(.9, .9))

print("------------------DOUBLE SELECTION-------------------")
rho = errs.bell_pair(0.1)
print("F initial: ", qt.fidelity(rho, rho_ref)**2)
rho = qt.tensor(rho, rho, rho)
p, check, rho = cb_ideal.double_selection_ops(rho, [0, 1], [2, 3], [4, 5], "Z")
print("p_success: ", p)
print("check: ", check)
print("F: ", qt.fidelity(rho, rho_ref)**2)
import qutip as qt
import protocols_old
import error_models as errs
import tools.operations as ops
import tools.p_success as ps

rho = errs.bell_pair(.4)
rho_ideal = qt.bell_state("00")
# print(de.fidelity(rho, rho_ideal))

prot = protocols_old.Protocols(0.0, 0.0075, 0.0075, .1)
prot_perf = protocols_old.Protocols(
    0.,
    0.,
    0.,
    0.,
)

print("------------------SINGLE SELECTION-------------------")
single = prot.single_selection(rho, [0, 1], "Z")
# print(single)
print(qt.fidelity(single, rho_ideal))

print("------------------ONE DOT-------------------")
one_dot = prot.one_dot(rho, [0, 1], "Z")
# print(one_dot)
print(qt.fidelity(one_dot, rho_ideal))

print("------------------TWO DOTS-------------------")
two_dot = prot.two_dots(rho, [0, 1], "X")
# print(two_dot)
Beispiel #4
0
CNOT1 = qt.cnot(4, 2, 0)
CNOT2 = qt.cnot(4, 3, 1)
GATE = CNOT1 * CNOT2
rho2 = GATE * rho2i * GATE.dag()

p1, rho2 = ops.forced_measure_single_Xbasis(rho2, 4, 2, 0, True)
print("p1: ", p1)
p2, rho2 = ops.forced_measure_single_Xbasis(rho2, 3, 2, 0, True)
print("p2: ", p2, p_ref(0.9263959390862941))
print("F: ",
      qt.fidelity(ref, rho2)**2, single_selection(0.9, 0.9263959390862941))

## Purification protocols for phi+
print("--------------------PHI--------------------")
ref = qt.bell_state('00')
rho_i = errs.bell_pair(p)
print("Initial F: ", qt.fidelity(ref, rho_i)**2)

rho_i = qt.tensor(rho_i, rho_i)

# Apply two_qubit_gates
CNOT1 = qt.cnot(4, 2, 0)
CNOT2 = qt.cnot(4, 3, 1)
GATE = CNOT1 * CNOT2
rho = GATE * rho_i * GATE.dag()

p1, rho = ops.forced_measure_single_Xbasis(rho, 4, 2, 0, True)
print("p1: ", p1)
p2, rho = ops.forced_measure_single_Xbasis(rho, 3, 2, 0, True)
print("p2: ", p2, p_ref(1 - p))
print("F: ", qt.fidelity(ref, rho)**2, single_selection(1 - p, 1 - p))