Purification

class sequence.entanglement_management.purification.BBPSSWCircuit(owner: Node, name: str, kept_memo: Memory, meas_memo: Memory)

Purification protocol instance.

This class provides an implementation of the BBPSSW purification protocol. It should be instantiated on a quantum router node.

Variables:

BBPSSW.circuit (Circuit): circuit that purifies entangled memories.

owner

node that protocol instance is attached to.

Type:

QuantumRouter

name

label for protocol instance.

Type:

str

kept_memo

memory to be purified by the protocol (should already be entangled).

meas_memo

memory to measure and discart (should already be entangled).

meas_res

measurement result from circuit.

Type:

int

remote_node_name

name of other node.

Type:

str

remote_protocol_name

name of other protocol

Type:

str

remote_memories

name of remote memories

Type:

list[str]

static improved_fidelity(f: float) float

Method to calculate fidelity after purification.

Formula comes from Dur and Briegel (2007) formula (18) page 14.

Parameters:

f (float) – fidelity of entanglement.

received_message(src: str, msg: BBPSSWMessage) None

Method to receive messages.

Parameters:
  • src (str) – name of node that sent the message.

  • msg (BBPSSW message) – message received.

Side Effects:

Will call update_resource_manager method.

start() None

Method to start entanglement purification.

Run the circuit below on two pairs of entangled memories on both sides of protocol.

o ——-(x)———-| M | . | . o —-.—————- . . . . . o . o

The overall circuit is shown below:

o ——-(x)———-| M | . | . o —-.—————- . . . . . o —-.—————- . | o ——-(x)———-| M |

Side Effects:

May update parameters of kept memory. Will send message to other protocol instance.

class sequence.entanglement_management.purification.BBPSSWMessage(msg_type: BBPSSWMsgType, receiver: str, meas_res: int, protocol_type: str = 'bbpssw')

Message used by entanglement purification protocols.

This message contains all information passed between purification protocol instances.

msg_type

defines the message type.

Type:

BBPSSWMsgType

receiver

name of destination protocol instance.

Type:

str

class sequence.entanglement_management.purification.BBPSSWMsgType(*values)

Defines possible message types for entanglement purification

class sequence.entanglement_management.purification.BBPSSWProtocol(owner: Node, name: str, kept_memo: Memory, meas_memo: Memory, **kwargs)
classmethod clear_global_formalism() None

Resets the global formalism to default

classmethod create(owner: Node, name: str, kept_memo: Memory, meas_memo: Memory, **kwargs) BBPSSWProtocol

Create an instance of a registered BBPSSW protocol.

Parameters:
  • owner (Node) – Node the protocol is attached to.

  • name (str) – Name of the protocol instance.

  • kept_memo (Memory) – Memory to keep and improve the fidelity.

  • meas_memo (Memory) – Memory to measure and discard.

Returns:

An instance of the requested BBPSSW protocol class.

classmethod get_formalism() str

Get the global formalism used by BBPSSW protocols.

Returns:

The global formalism used by BBPSSW protocols.

is_ready() bool

Check if the protocol is ready to start.

classmethod list_protocols() list[str]

List all registered BBPSSW protocols.

memory_expire(memory: Memory) None

Method to receive memory expiration events.

Parameters:

memory (Memory) – The memory that has expired.

Side Effects:

Will call update_resource_manager method.

abstractmethod received_message(src: str, msg: BBPSSWMessage) None

Method to receive messages.

Parameters:
  • src (str) – Name of the node that sent the message.

  • msg (BBPSSWMessage) – Message received.

Side Effects:

Will call update_resource_manager method.

classmethod register(name: str, protocol_class: type[BBPSSWProtocol] | None = None) Callable[[type[BBPSSWProtocol]], type[BBPSSWProtocol]] | None

Register a BBPSSW protocol class. Can be used as a decorator or as a normal function.

Recommended Usage: Use a decorator to register a BBPSSW protocol class on the user side. Use as a direct call on the backend.

Parameters:
  • name (str) – Name of the protocol to register.

  • protocol_class (Type[BBPSSWProtocol], optional) – The protocol class to register

Returns:

If used as a decorator, returns the decorator function. If used as a direct call, returns None.

Examples

# Using as a decorator @BBPSSWProtocol.register(‘new_fancy_bbpssw’) class NewFancyBBPSSW(BBPSSWProtocol):

pass …

# Using as a direct call class AnotherFancyBBPSSW(BBPSSWProtocol):

pass …

BBPSSWProtocol.register(‘another_fancy_bbpssw’, AnotherFancyBBPSSW)

classmethod set_formalism(formalism: str) None

Set the global formalism used by BBPSSW protocols.

Valid Built-formalisms:
  1. Bell Diagonal -> bds

  2. Circuit -> circuit (DEFAULT)

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.

abstractmethod start() None

Method to start the entanglement purification protocol.

Side Effects:

May update parameters of kept memory. Will send message to other protocol instance.

class sequence.entanglement_management.purification.BBPSSW_BDS(owner: Node, name: str, kept_memo: Memory, meas_memo: Memory, is_twirled=True)

Purification protocol instance.

This class provides an implementation of the BBPSSW purification protocol. It should be instantiated on a quantum router node. This version of the BBPSSW uses the Bell Diagonal State formalism

owner

node that protocol instance is attached to.

Type:

QuantumRouter

name

label for protocol instance.

Type:

str

kept_memo

memory to be purified by the protocol (should already be entangled).

meas_memo

memory to measure and discart (should already be entangled).

meas_res

measurement result from circuit.

Type:

int

remote_node_name

name of other node.

Type:

str

remote_protocol_name

name of other protocol.

Type:

str

remote_memories

name of remote memories.

Type:

List[str]

is_twirled

whether we twirl the input and output BDS. True: BBPSSW, False: DEJMPS. (default True)

Type:

bool

purification_res() tuple[float, ndarray[tuple[Any, ...], dtype[_ScalarT]]]

Method to calculate the correct success probability of a purification trial with BDS input.

The four BDS density matrix elements of kept entangled pair conditioned on successful purification.

Returns:

success probability and BDS density matrix elements of kept entangled pair.

Return type:

Tuple[float, np.array]

received_message(src: str, msg: BBPSSWMessage) None

Method to receive messages.

Parameters:
  • src (str) – name of node that sent the message.

  • msg (BBPSSW message) – message received.

Side Effects:

Will call update_resource_manager method.

start() None

Method to start entanglement purification.

Run the circuit below on two pairs of entangled memories on both sides of protocol. (Original implementation)

Side Effects:

May update parameters of kept memory. Will send message to other protocol instance.