:py:mod:`kosmos.quantum_logic.quantum_register_manager` ======================================================= .. py:module:: kosmos.quantum_logic.quantum_register_manager Module Attributes ----------------- .. py:data:: BELL_PAIR_QUBITS :value: 2 .. py:data:: MIN_FIDELITY_THRESHOLD :value: 0.25 Classes ------- .. py: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. :param network: The network topology. :type network: Network | .. rubric:: Methods .. py:method:: 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. :param node: Reference to the node where the qubit resides. :type node: NodeReference :param qubit_id: Identifier for qubit. :type qubit_id: QubitId | str :param qubit_type: Type of qubit to allocate. Defaults to Communication qubit. :type qubit_type: QubitType :returns: The newly created and registered qubit. :rtype: Qubit .. py:method:: move_qubit(qubit: kosmos.quantum_logic.typing.QubitReference, new_node: kosmos.topology.typing.NodeReference) -> None Allocate qubit to a new node. :param qubit: Qubit reference of the qubit to be moved. :type qubit: QubitReference :param new_node: Reference to the node to which qubit is to be moved. :type new_node: NodeReference .. py:method:: remove_qubit(qubit: kosmos.quantum_logic.typing.QubitReference) -> None Remove qubit and corresponding state. :param qubit: Reference of the qubit to be removed. :type qubit: QubitReference .. py:method:: 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. :param qubit: The qubit to assign the state to. :type qubit: QubitReference :param state: The QuantumState for the qubit. :type state: QuantumState .. py:method:: get_qubits_by_node(node: kosmos.topology.typing.NodeReference) -> list[kosmos.quantum_logic.qubit.QubitId] Get all qubits located at a specific node. :param node: Reference to the node. :type node: NodeReference :returns: QubitIds allocated at certain node. :rtype: list[QubitId] .. py:method:: 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. :param entanglement: The entanglement we want to add to the system. :type entanglement: EntanglementLink :param state: The according QuantumState we want to add to the system. :type state: QuantumState .. py:method:: remove_entanglement(qubits: list[kosmos.quantum_logic.typing.QubitReference]) -> None Remove entanglement from system. :param qubits: The list of qubits we want to remove. :type qubits: list[QubitReference] .. py:method:: 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. :param nodes: References of the nodes. :type nodes: list[NodeReference] :param qubit_ids: Identifier of qubits. :type qubit_ids: list[QubitId | str] :param current_time: Time of Bell pair generation. Defaults to 0. :type current_time: int :param fidelity: Fidelity of the entangled state. Defaults to 1.0. :type fidelity: float .. py:method:: 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. :param state: Quantum state we want to retrieve the substate from. :type state: QuantumState :param keep: List of indices of qubits to keep. :type keep: list[int] :param dims: Dimension for subsystem. :type dims: list[int] :returns: The quantum state for specific qubit or qubits. :rtype: QuantumState .. py:method:: 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. :param qubits: Qubits we want to receive the state from. :type qubits: list[QubitReference] :param return_partial_state: Whether a substate is returned or not. :type return_partial_state: bool | None :returns: The quantum state for the specified qubits, or None if not found. :rtype: QuantumState or None