cunqa.qc_protocols
Quantum-communication protocols for distributed circuits.
This subpackage provides the high-level helpers built on top of the
gen_ent primitive to communicate quantum information
between circuits running on different vQPUs:
Teledata (
qsend/qrecv): teleports the state of a data qubit from one circuit to another.Telegate (
cat_entangler/cat_disentangler): shares a control qubit across circuits so that remote controlled gates can be applied locally.
These functions reserve communication qubits on the participating circuits (created via the
CunqaCircuit((num_data, num_comm), num_clbits) form), so each circuit must declare enough comm
qubits beforehand.
- qsend(circuit, data_qubit, comm_qubit, clbits, recving_circuit, tag=None)
Teledata sender: teleports the state of
data_qubitfromcircuitto a remote circuit.This is the teleportation-protocol counterpart of
qrecv, which must be applied on the receiving circuit with the sametag. Internally it generates the shared entanglement withgen_ent, performs the Bell measurement and sends the two classical correction bits to the remote circuit.- Parameters:
circuit (CunqaCircuit) – circuit holding the qubit to be teleported.
data_qubit (int) – computation qubit whose state is teleported.
comm_qubit (int) – communication qubit employed to send.
clbits (list[int]) – two classical bits used to store the Bell-measurement outcomes.
recving_circuit (str | CunqaCircuit) – id of the circuit or circuit object to which the qubit is teleported.
tag (str) – identifier shared with the matching
qrecvcall.
- Return type:
None
- qrecv(circuit, data_qubit, comm_qubit, clbits, control_circuit, tag=None)
Teledata receiver: reconstructs into
data_qubitthe state teleported by a remote circuit.This is the receiving counterpart of
qsendand must be called with the sametag. Internally it generates the shared entanglement withgen_ent, receives the two classical correction bits and applies the conditional Pauli corrections.- Parameters:
circuit (CunqaCircuit) – circuit that receives the teleported state.
data_qubit (int) – computation qubit to which the received state is assigned.
comm_qubit (int) – communication qubit employed to receive.
clbits (list[int]) – two classical bits used to store the received correction bits.
control_circuit (str | CunqaCircuit) – id of the circuit or circuit object from which the qubit is received.
tag (str) – identifier shared with the matching
qsendcall.
- Return type:
None
- cat_entangler(target_circuits, data_qubit, comm_qubits, clbits, tag=None)
Telegate entangler: distributes the control state of
data_qubit(held by the first circuit intarget_circuits) onto the comm qubits of the remaining circuits, so that they can apply gates locally controlled by it.It opens a telegate block that must be closed with
cat_disentanglerusing the same set oftarget_circuits. Between the two calls, each receiving circuit applies the gate(s) controlled on its comm qubit. Internally it requests the shared GHZ state withgen_ent.- Parameters:
target_circuits (list[CunqaCircuit]) – participating circuits; the first one owns the control
data_qubitand the rest receive it on their comm qubit.data_qubit (int) – control qubit (in the first circuit) to be shared.
comm_qubits (list[int]) – comm qubit of each circuit in
target_circuits.clbits (list[int]) – classical bit used by each circuit for the entangler corrections.
tag (str) – identifier shared with the matching
cat_disentanglercall.
- cat_disentangler(target_circuits, data_qubit, comm_qubits, recv_clbits, send_clbits)
Telegate disentangler: closes the telegate block opened by
cat_entangler, undoing the shared entanglement and restoring the comm qubits, while propagating the required phase correction back to the controldata_qubit.It must be called with the same
target_circuitsused in the matchingcat_entangler, after the receiving circuits have applied their controlled gates.- Parameters:
target_circuits (list[CunqaCircuit] | list[str]) – the same participants passed to
cat_entangler; the first one owns the controldata_qubit.data_qubit (int) – control qubit (in the first circuit) the correction is applied to.
comm_qubits (list[int]) – comm qubit of each receiving circuit.
recv_clbits (list[int]) – classical bits the first circuit uses to receive the corrections.
send_clbits (list[int]) – classical bits the receiving circuits use to send their corrections.