kosmos.quantum_logic.quantum_register_manager

Module Attributes

BELL_PAIR_QUBITS = 2
MIN_FIDELITY_THRESHOLD = 0.25

Classes

class QuantumRegisterManager(network: kosmos.topology.net.Network)[source]

Manager for quantum logic in the network.

This manager handles all qubits, entanglements and quantum states in the system.

qubits

Mapping from qubit IDs to their corresponding Qubit object.

Type:

dict[QubitId, Qubit]

states

Mapping from qubit IDs to their corresponding quantum state.

Type:

dict[frozenset[QubitId], QuantumState]

Initialize quantum register manager.

Parameters:

network (Network) – The network topology.


Methods

allocate_qubit(*, node: kosmos.topology.typing.NodeReference, qubit_id: kosmos.quantum_logic.qubit.QubitId | str, qubit_type: kosmos.quantum_logic.qubit.QubitType = QubitType.COMMUNICATION) kosmos.quantum_logic.qubit.Qubit[source]

Allocate a new qubit in the system for a given node and type.

Parameters:
  • node (NodeReference) – Reference to the node where the qubit resides.

  • qubit_id (QubitId | str) – Identifier for qubit.

  • qubit_type (QubitType) – Type of qubit to allocate. Defaults to Communication qubit.

Returns:

The newly created and registered qubit.

Return type:

Qubit

move_qubit(qubit: kosmos.quantum_logic.typing.QubitReference, new_node: kosmos.topology.typing.NodeReference) None[source]

Allocate qubit to a new node.

Parameters:
  • qubit (QubitReference) – Qubit reference of the qubit to be moved.

  • new_node (NodeReference) – Reference to the node to which the qubit is to be moved.

remove_qubit(qubit: kosmos.quantum_logic.typing.QubitReference) None[source]

Remove qubit and corresponding state.

Parameters:

qubit (QubitReference) – Reference of the qubit to be removed.

get_qubits_by_node(node: kosmos.topology.typing.NodeReference) list[kosmos.quantum_logic.qubit.QubitId][source]

Get all qubits located at a specific node.

Parameters:

node (NodeReference) – Reference to the node.

Returns:

QubitIds allocated at certain node.

Return type:

list[QubitId]

add_com_entanglement(entanglement: kosmos.quantum_logic.entanglement_link.EntanglementLink, state: kosmos.quantum_logic.quantum_state.QuantumState) None[source]

Add communication entanglement to quantum register manager.

If the qubits are part of single-qubit states, remove them. If the qubits are part of multi-qubit states, raise an error.

Parameters:
  • entanglement (EntanglementLink) – The entanglement we want to add to the system.

  • state (QuantumState) – The according QuantumState we want to add to the system.

remove_com_entanglement(qubits: list[kosmos.quantum_logic.typing.QubitReference]) None[source]

Remove communication entanglement from system.

Parameters:

qubits (list[QubitReference]) – The list of qubits we want to remove.

allocate_bell_pair(nodes: list[kosmos.topology.typing.NodeReference], qubit_ids: list[kosmos.quantum_logic.qubit.QubitId | str], fidelity: float = 1.0) None[source]

Allocates two new communication qubits and a Bell state.

Parameters:
  • nodes (list[NodeReference]) – References of the nodes.

  • qubit_ids (list[QubitId | str]) – Identifier of qubits.

  • fidelity (float) – Fidelity of the entangled state. Defaults to 1.0.

find_entanglement_between_nodes(source_node: kosmos.topology.node.QuantumNode, target_node: kosmos.topology.node.QuantumNode) frozenset[kosmos.quantum_logic.qubit.QubitId] | None[source]

Find a communication entanglement that involves both given nodes.

Parameters:
  • source_node (QuantumNode) – First quantum node that should be included in the entanglement.

  • target_node (QuantumNode) – Second quantum node that should be included in the entanglement.

Returns:

A frozenset of the QubitId values participating in

the entanglement, or None if no matching entanglement exists.

Return type:

frozenset[QubitId] | None

Functions

create_bell_state(fidelity: float = 1.0) kosmos.quantum_logic.quantum_state.QuantumState[source]

Create a Bell state with given fidelity.

Parameters:

fidelity (float) – Desired fidelity (0-1). Defaults to 1.0.

Returns:

Bell state with specified fidelity.

Return type:

QuantumState