def simulaqron(): from cqc.pythonLib import CQCConnection from qpz_atomics.mappings.simulaqron import mapping with CQCConnection("Alice") as Alice: _ = qpz_atomics.lib(mapping, Alice) #use library to prepare a single qubit # all commands are applied locally: no need to specify the node q = _.PREP() # show info about created qubit _.DISP(q) # flip the qubit _.X(q) # sending to Bob (need to pass the arguments using the syntax used by the backend used) _.SEND(q, "Bob") with CQCConnection("Bob") as Bob: _ = qpz_atomics.lib(mapping, Bob) # receive a qubit q = _.RECV() # show info about this qubit _.DISP(q)
def source_protocol(source_host, target_host_id): _ = qpz_atomics.lib(mapping, source_host) for i in range(5): q = _.PREP() q = _.H(q) print("sending"), _.DISP(q) _.SEND(q, target_host_id)
def target_protocol(target_host, source_host_id): _ = qpz_atomics.lib(mapping, target_host) for i in range(5): print(source_host_id) q = _.RECV(source_host_id) print("recieved"), _.DISP(q)
def test_meas_pauli(bit, base): with CQCConnection("Alice") as Alice: _ = qpz_atomics.lib(mapping, Alice) meas.pauli(_, bit, base)
def test_prep_ghz(nb_target_nodes, basis): with CQCConnection("Alice") as Alice: _ = qpz_atomics.lib(mapping, Alice) prep.ghz(_, nb_target_nodes, basis)
def test_pres_qotp(ck_b): with CQCConnection("Alice") as Alice: _ = qpz_atomics.lib(mapping, Alice) pres.qotp(_, ck_b)