Generation

class sequence.entanglement_management.generation.BarretKokA(owner: Node, name: str, middle: str, other: str, memory: Memory, **kwargs: Any)

Entanglement generation protocol for quantum router.

The EntanglementGenerationA protocol should be instantiated on a quantum router node. Instances will communicate with each other (and with the B instance on a BSM node) to generate entanglement.

owner

node that protocol instance is attached to.

Type:

QuantumRouter

name

label for protocol instance.

Type:

str

middle

name of BSM measurement node where emitted photons should be directed.

Type:

str

remote_node_name

name of distant QuantumRouter node, containing a memory to be entangled with local memory.

Type:

str

memory

quantum memory object to attempt entanglement for.

Type:

Memory

emit_event() None

Method to set up memory and emit photons.

If the protocol is in round 1, the memory will be first set to the |+> state. Otherwise, it will apply an x_gate to the memory. Regardless of the round, the memory excite method will be invoked.

Side Effects:

May change state of attached memory. May cause attached memory to emit photon.

received_message(src: str, msg: EntanglementGenerationMessage) None

Method to receive messages.

This method receives messages from other entanglement generation protocols. Depending on the message, different actions may be taken by the protocol.

Parameters:
Side Effects:

May schedule various internal and hardware events.

update_memory() bool | None

Method to handle necessary memory operations.

Called on both nodes. Will check the state of the memory and protocol.

Returns:

if current round was successful.

Return type:

bool

Side Effects:

May change state of attached memory. May update memory state in the attached node’s resource manager.

class sequence.entanglement_management.generation.BarretKokB(owner: BSMNode, name: str, others: list[str])

Entanglement generation protocol for BSM node.

The EntanglementGenerationB protocol should be instantiated on a BSM node. Instances will communicate with the A instance on neighboring quantum router nodes to generate entanglement.

owner

node that protocol instance is attached to.

Type:

BSMNode

name

label for protocol instance.

Type:

str

others

list of neighboring quantum router nodes

Type:

list[str]

bsm_update(bsm: SingleAtomBSM, info: dict[str, Any])

Must be implemented in a subclass

class sequence.entanglement_management.generation.EntanglementGenerationA(owner: Node, name: str, middle: str, other: str, memory: Memory, **kwargs)
Abstract base class for Entanglement Generation Protocol A.

This class provides a framework for implementing entanglement generation protocols

Class Attributes:

_registry (dict[str, type[‘EntanglementGenerationA’]]): A registry mapping protocol names to their corresponding classes. _global_type (str): The globally set protocol type used when creating new instances. Defaults to BARRET_KOK, other options: SINGLE_HERALDED

Instance Attributes:

protocol_type (str): The type of the entanglement generation protocol. middle (str): The name of the middle BSM node used in the protocol. remote_node_name (str): The name of the remote node involved in the protocol. remote_protocol_name (str): The name of the remote protocol instance paired to this protocol. memory (Memory): The memory managed by this protocol. memories (list[Memory]): A list containing the single memory managed by this protocol. remote_memo_id (str): The identifier (name) of the remote memory used in the protocol. qc_delay (int): The quantum channel delay to the middle node (in ps). expected_time (int): expected time for middle BSM node to receive the photon (in ps). fidelity (float): The fidelity of the entangled state produced by the protocol. ent_round (int): The current round of entanglement generation (total two rounds in Barrett-Kok). bsm_res (list[int]): The result of the Bell State Measurement (BSM), initialized to [-1, -1]. scheduled_events (list[Event]): A list of scheduled events for the protocol. primary (bool): Indicates if this node is the primary node in the protocol (based on lexicographical order of node names). _qstate_key (int): The key of the quantum states associated with the memory used in the protocol.

abstractmethod emit_event() None

Must be implemented in a subclass

is_ready() bool

Method to check if protocol is ready to start (abstract).

Returns:

if protocol is ready or not.

Return type:

bool

classmethod list_protocols() list[str]

List all registered EntanglementGenerationA protocols.

memory_expire(memory: Memory) None

Method to receive a memory expiration event (abstract).

received_message(src: str, msg: EntanglementGenerationMessage) None

Must be implemented in a subclass

classmethod register(name: str, protocol_class: type[EntanglementGenerationA] = None)

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

set_others(protocol: str, node: str, memories: list[str]) None

Method to set other entanglement protocol instance.

Parameters:
  • remote_protocol (str) – other protocol name.

  • remote_node (str) – other node name.

  • memories (list[str]) – the list of memory names used on other node.

start() None

Method to start “one round” in the entanglement generation protocol (there are two rounds in Barrett-Kok).

Will start negotiations with other protocol (if primary).

Side Effects:

Will send message through attached node.

update_memory() bool | None

Update memory state. Must be implemented in a subclass

class sequence.entanglement_management.generation.EntanglementGenerationB(owner: BSMNode, name: str, others: list[str], **kwargs)
bsm_update(bsm, info: dict[str, Any]) None

Must be implemented in a subclass

is_ready() bool

Method to check if protocol is ready to start (abstract).

Returns:

if protocol is ready or not.

Return type:

bool

classmethod list_protocols() list[str]

List all registered EntanglementGenerationA protocols.

memory_expire(memory: Memory) None

Method to receive a memory expiration event (abstract).

received_message(src: str, msg: EntanglementGenerationMessage) None

Receive classical message from another node.

classmethod register(name: str, protocol_class: type[EntanglementGenerationB] = None)

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

set_others(protocol: str, node: str, memories: list[str]) None

Method to set other entanglement protocol instance.

Parameters:
  • remote_protocol (str) – other protocol name.

  • remote_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 sequence.entanglement_management.generation.EntanglementGenerationMessage(msg_type: GenerationMsgType, receiver: str | None, protocol_type: str, **kwargs)

Message used by entanglement generation protocols.

This message contains all information passed between generation protocol instances. Messages of different types contain different information.

msg_type

defines the message type.

Type:

GenerationMsgType

receiver

name of destination protocol instance.

Type:

str

qc_delay

quantum channel delay to BSM node (if msg_type == NEGOTIATE).

Type:

int

frequency

frequency with which local memory can be excited (if msg_type == NEGOTIATE).

Type:

float

emit_time

time to emit photon for measurement (if msg_type == NEGOTIATE_ACK).

Type:

int

detector

detector number at BSM node (if msg_type == MEAS_RES).

Type:

int

time

detection time at BSM node (if msg_type == MEAS_RES).

Type:

int

resolution

time resolution of BSM detectors (if msg_type == MEAS_RES).

Type:

int

class sequence.entanglement_management.generation.GenerationMsgType(*values)

Defines possible message types for entanglement generation.

class sequence.entanglement_management.generation.SingleHeraldedA(owner: Node, name: str, middle: str, other: str, memory: Memory, raw_fidelity: float = None, raw_epr_errors: list[float] = None)

Class for single heralded entanglement generation protocol A. This protocol is used on the two end nodes of the entanglement generation process.

owner

node that protocol instance is attached to.

Type:

Node

name

label for protocol instance.

Type:

str

middle

name of the middle BSM node.

Type:

str

other

name of the other end node.

Type:

str

memory

memory object used for entanglement generation.

Type:

Memory

raw_fidelity

the raw fidelity of generated entangled pair.

Type:

float

raw_epr_errors

the raw EPR pair Pauli error rates in X, Y, Z order.

Type:

list[float]

bsm_res

the BSM measurement results from the middle BSM node.

Type:

list[int]

emit_event() None

Method to set up memory and emit photons.

If the protocol is in round 1, the memory will be first set to the |+> state. Otherwise, it will apply an x_gate to the memory. Regardless of the round, the memory excite method will be invoked.

Side Effects:

May change state of attached memory. May cause attached memory to emit photon.

received_message(src: str, msg: EntanglementGenerationMessage) None

Method to receive messages.

This method receives messages from other entanglement generation protocols. Depending on the message, different actions may be taken by the protocol.

Parameters:
Side Effects:

May schedule various internal and hardware events.

update_memory() bool | None

Method to handle necessary memory operations.

Called on both nodes. Will check the state of the memory and protocol.

Returns:

if current round was successful.

Return type:

bool

Side Effects:

May change state of attached memory. May update memory state in the attached node’s resource manager.

class sequence.entanglement_management.generation.SingleHeraldedB(owner: BSMNode, name: str, others: list[str])
bsm_update(bsm: SingleHeraldedBSM, info: dict[str, Any]) None

Method to receive detection events from BSM on node.

Parameters: