Entanglement Swapping¶
Code for entanglement swapping.
This module defines code for entanglement swapping. Success is pre-determined based on network parameters. The entanglement swapping protocol is an asymmetric protocol:
The EntanglementSwappingA instance initiates the protocol and performs the swapping operation.
The EntanglementSwappingB instance waits for the swapping result from EntanglementSwappingA.
The swapping results decides the following operations of EntanglementSwappingB. Also defined in this module is the message type used by these protocols.
- class src.entanglement_management.swapping.EntanglementSwappingA(own: Node, name: str, left_memo: Memory, right_memo: Memory, success_prob=1, degradation=0.95)¶
Entanglement swapping protocol for middle router.
The entanglement swapping protocol is an asymmetric protocol. EntanglementSwappingA should be instantiated on the middle node, where it measures a memory from each pair to be swapped. Results of measurement and swapping are sent to the end routers.
- Variables:
EntanglementSwappingA.circuit (Circuit): circuit that does swapping operations.
- name¶
label for protocol instance.
- Type:
str
- left_node¶
name of node that contains memory entangling with left_memo.
- Type:
str
- left_remote_memo¶
name of memory that entangles with left_memo.
- Type:
str
- right_node¶
name of node that contains memory entangling with right_memo.
- Type:
str
- right_remote_memo¶
name of memory that entangles with right_memo.
- Type:
str
- success_prob¶
probability of a successful swapping operation.
- Type:
float
- degradation¶
degradation factor of memory fidelity after swapping.
- Type:
float
- is_success¶
flag to show the result of swapping
- Type:
bool
- left_protocol_name¶
name of left protocol.
- Type:
str
- right_protocol_name¶
name of right protocol.
- Type:
str
- is_ready() bool ¶
Method to check if protocol is ready to start (abstract).
- Returns:
if protocol is ready or not.
- Return type:
bool
- memory_expire(memory: Memory) None ¶
Method to receive memory expiration events.
Releases held memories on current node. Memories at the remote node are released as well.
- Parameters:
memory (Memory) – memory that expired.
- Side Effects:
Will invoke update method of attached resource manager. Will invoke release_remote_protocol or release_remote_memory method of resource manager.
- received_message(src: str, msg: Message) None ¶
Method to receive messages (should not be used on A protocol).
- set_others(protocol: str, node: str, memories: List[str]) None ¶
Method to set other entanglement protocol instance.
- Parameters:
protocol (str) – other protocol name.
node (str) – other node name.
memories (List[str]) – the list of memories name used on other node.
- start() None ¶
Method to start entanglement swapping protocol.
Will run circuit and send measurement results to other protocols.
- Side Effects:
Will call update_resource_manager method. Will send messages to other protocols.
- success_probability() float ¶
A simple model for BSM success probability.
- updated_fidelity(f1: float, f2: float) float ¶
A simple model updating fidelity of entanglement.
- Parameters:
f1 (float) – fidelity 1.
f2 (float) – fidelity 2.
- Returns:
fidelity of swapped entanglement.
- Return type:
float
- class src.entanglement_management.swapping.EntanglementSwappingB(own: Node, name: str, hold_memo: Memory)¶
Entanglement swapping protocol for end router.
The entanglement swapping protocol is an asymmetric protocol. EntanglementSwappingB should be instantiated on the end nodes, where it waits for swapping results from the middle node.
- Variables:
EntanglementSwappingB.x_cir (Circuit): circuit that corrects state with an x gate. EntanglementSwappingB.z_cir (Circuit): circuit that corrects state with z gate. EntanglementSwappingB.x_z_cir (Circuit): circuit that corrects state with an x and z gate.
- own¶
node that protocol instance is attached to.
- Type:
- name¶
name of protocol instance.
- Type:
str
- remote_protocol_name¶
name of another protocol to communicate with for swapping.
- Type:
str
- remote_node_name¶
name of node hosting the other protocol.
- Type:
str
- is_ready() bool ¶
Method to check if protocol is ready to start (abstract).
- Returns:
if protocol is ready or not.
- Return type:
bool
- memory_expire(memory: Memory) None ¶
Method to deal with expired memories.
- Parameters:
memory (Memory) – memory that expired.
- Side Effects:
Will update memory in attached resource manager.
- received_message(src: str, msg: EntanglementSwappingMessage) None ¶
Method to receive messages from EntanglementSwappingA.
- Parameters:
src (str) – name of node sending message.
msg (EntanglementSwappingMesssage) – message sent.
- Side Effects:
Will invoke update_resource_manager method.
- release() None ¶
Method to release attached memories.
- set_others(protocol: str, node: str, memories: List[str]) None ¶
Method to set other entanglement protocol instance.
- Parameters:
protocol (str) – other protocol name.
node (str) – other node name.
memories (List[str]) – the list of memory names used on other node.
- start() None ¶
Method to start entanglement protocol process (abstract).
- class src.entanglement_management.swapping.EntanglementSwappingMessage(msg_type: SwappingMsgType, receiver: str, **kwargs)¶
Message used by entanglement swapping protocols.
This message contains all information passed between swapping protocol instances.
- msg_type¶
defines the message type.
- Type:
- receiver¶
name of destination protocol instance.
- Type:
str
- fidelity¶
fidelity of the newly swapped memory pair.
- Type:
float
- remote_node¶
name of the distant node holding the entangled memory of the new pair.
- Type:
str
- remote_memo¶
index of the entangled memory on the remote node.
- Type:
int
- expire_time¶
expiration time of the new memory pair.
- Type:
int
- class src.entanglement_management.swapping.SwappingMsgType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Defines possible message types for entanglement generation.