should we measure in Bell frst?

This commit is contained in:
Daniel Tsvetkov 2020-03-28 10:26:11 +01:00
parent 3a3b0915a5
commit 1b7c3a6cdc

View File

@ -107,10 +107,24 @@ def test_krisi_measurement_3():
q1 = State.from_bloch_angles(theta1, phi1)
q2 = State.from_bloch_angles(theta2, phi2)
# Measure in the arbitrary basis
st = State(q0 * q1 * q2)
meas = st.measure(basis=basis)
# TODO: This part measures the first two qubits in Bell basis, then:
# 1. constructs a new pure state
# (e.g. if result was 11, constructs |11>)
# 2. Combines this new pure state with the third qubit
MEASURE_FIRST_BELL = False
if MEASURE_FIRST_BELL:
# Measure in the Bell's basis
st = State(q0 * q1)
meas = st.measure(basis=[b_phi_p, b_phi_m, b_psi_p, b_psi_m])
new_st = s("|" + meas + ">")
st = State(new_st * q2)
else:
# TODO: -OR- alternatively - measure all three without measuring in
# Bell first
st = State(q0 * q1 * q2)
# Measure in the 8D basis
meas = st.measure(basis=basis)
return meas
def krisi_3_format_results(results):