:py:mod:`kosmos.partitioning.partition` ======================================= .. py:module:: kosmos.partitioning.partition Classes ------- .. py:class:: Partition Circuit partition with QPU assignment. .. attribute:: id Identifier for the partition. :type: str .. attribute:: circuit Quantum circuit assigned to this partition. :type: QuantumCircuit .. attribute:: logical_qubit_mapping Mapping from logical to physical qubit indices. :type: dict[int, int] .. attribute:: original_gate_indices Indices of gates from the original circuit that are in this partition. :type: list[int] .. attribute:: start_time Scheduled start time for partition execution, if allocated. :type: int | None .. attribute:: node The quantum node this partition is allocated to, if single-node partition. :type: QuantumNode | None .. attribute:: qubit_to_node_mapping Mapping from physical qubits to nodes for multi-node partitions. :type: dict[int, QuantumNode] | .. rubric:: Properties .. py:property:: min_gate_index Get earliest gate index from original circuit. :returns: Minimum gate index, or infinity if no gates. :rtype: int .. py:property:: physical_qubits_used Get set of physical qubits used by this partition. :returns: Qubit indices from the original circuit. :rtype: set[int] .. py:property:: is_multi_node Check if partition is allocated acress multiple nodes. :returns: True if partitions spans mutliple nodes. :rtype: bool .. py:property:: allocated_nodes Get all nodes this partition is allocated to. :returns: Set of nodes hosting qubits from this partition. :rtype: set[QuantumNode] .. py:property:: end_time Calculate end time based on start time and circuit depth. :returns: Time the partition finishes, if a start time is given. :rtype: int | None | .. rubric:: Methods .. py:method:: get_node_for_qubit(physical_qubit: int) -> kosmos.topology.node.QuantumNode | None Get the node hosting a specific physical qubit. :param physical_qubit: Physical qubit index. :type physical_qubit: int :returns: Node hosting the qubit, or None if not allocated. :rtype: QuantumNode | None Functions --------- .. py:function:: create_subcircuit_from_gates(gate_list: list[dict]) -> tuple[qiskit.QuantumCircuit, dict[int, int]] Create a subcircuit from a list of gates. :param gate_list: List of gate dictionaries. :type gate_list: list[dict] :returns: Subcircuit and logical to physical qubit mapping. :rtype: tuple[QuantumCircuit, dict[int, int]] .. py:function:: partitions_from_assignments(circuit: qiskit.QuantumCircuit, assignments: dict[int, int]) -> list[Partition] Convert partitioning assignments to Partition objects. :param circuit: Original circuit. :type circuit: QuantumCircuit :param assignments: Gate index to partition ID mapping. :type assignments: dict[int, int] :returns: List of Partition objects with subcircuits. :rtype: list[Partition]