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)

Manager for quantum logic in the network.

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

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

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

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 qubit is to be moved.

remove_qubit(qubit: kosmos.quantum_logic.typing.QubitReference) None

Remove qubit and corresponding state.

Parameters:

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

add_single_qubit_state(qubit: kosmos.quantum_logic.typing.QubitReference, state: kosmos.quantum_logic.quantum_state.QuantumState) None

Add or update the state of a single qubit.

If the qubit is part of a single-qubit state, update it. If the qubit is part of a multi-qubit state, raise an error.

Parameters:
  • qubit (QubitReference) – The qubit to assign the state to.

  • state (QuantumState) – The QuantumState for the qubit.

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

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_entanglement(entanglement: kosmos.quantum_logic.entanglement_link.EntanglementLink, state: kosmos.quantum_logic.quantum_state.QuantumState) None

Add entanglement to state system 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_entanglement(qubits: list[kosmos.quantum_logic.typing.QubitReference]) None

Remove 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], current_time: int = 0, fidelity: float = 1.0) None

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.

  • current_time (int) – Time of Bell pair generation. Defaults to 0.

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

get_partial_trace(state: kosmos.quantum_logic.quantum_state.QuantumState, keep: list[int], dims: list[int]) kosmos.quantum_logic.quantum_state.QuantumState

Retrieve state of a subsystem.

Parameters:
  • state (QuantumState) – Quantum state we want to retrieve the substate from.

  • keep (list[int]) – List of indices of qubits to keep.

  • dims (list[int]) – Dimension for subsystem.

Returns:

The quantum state for specific qubit or qubits.

Return type:

QuantumState

get_state(qubits: list[kosmos.quantum_logic.typing.QubitReference], *, return_partial_state: bool | None) kosmos.quantum_logic.quantum_state.QuantumState | None

Retrieve (specific) state from system.

If return_partial_state = True we return only the state of the input subsystem.

Parameters:
  • qubits (list[QubitReference]) – Qubits we want to receive the state from.

  • return_partial_state (bool | None) – Whether a substate is returned or not.

Returns:

The quantum state for the specified qubits, or None if not found.

Return type:

QuantumState or None