kosmos.partitioning.partition

Classes

class Partition[source]

Circuit partition with QPU assignment.

id

Identifier for the partition.

Type:

str

circuit

Quantum circuit assigned to this partition.

Type:

QuantumCircuit

logical_qubit_mapping

Mapping from logical to physical qubit indices.

Type:

dict[int, int]

original_gate_indices

Indices of gates from the original circuit that are in this partition.

Type:

list[int]

start_time

Scheduled start time for partition execution, if allocated.

Type:

int | None

node

The quantum node this partition is allocated to, if single-node partition.

Type:

QuantumNode | None

qubit_to_node_mapping

Mapping from physical qubits to nodes for multi-node partitions.

Type:

dict[int, QuantumNode]


Properties

property min_gate_index

Get earliest gate index from original circuit.

Returns:

Minimum gate index, or infinity if no gates.

Return type:

int

property physical_qubits_used

Get set of physical qubits used by this partition.

Returns:

Qubit indices from the original circuit.

Return type:

set[int]

property is_multi_node

Check if partition is allocated acress multiple nodes.

Returns:

True if partitions spans mutliple nodes.

Return type:

bool

property allocated_nodes

Get all nodes this partition is allocated to.

Returns:

Set of nodes hosting qubits from this partition.

Return type:

set[QuantumNode]

property end_time

Calculate end time based on start time and circuit depth.

Returns:

Time the partition finishes, if a start time is given.

Return type:

int | None


Methods

get_node_for_qubit(physical_qubit: int) kosmos.topology.node.QuantumNode | None[source]

Get the node hosting a specific physical qubit.

Parameters:

physical_qubit (int) – Physical qubit index.

Returns:

Node hosting the qubit, or None if not allocated.

Return type:

QuantumNode | None

Functions

create_subcircuit_from_gates(gate_list: list[dict]) tuple[qiskit.QuantumCircuit, dict[int, int]][source]

Create a subcircuit from a list of gates.

Parameters:

gate_list (list[dict]) – List of gate dictionaries.

Returns:

Subcircuit and logical to physical qubit mapping.

Return type:

tuple[QuantumCircuit, dict[int, int]]

partitions_from_assignments(circuit: qiskit.QuantumCircuit, assignments: dict[int, int]) list[Partition][source]

Convert partitioning assignments to Partition objects.

Parameters:
  • circuit (QuantumCircuit) – Original circuit.

  • assignments (dict[int, int]) – Gate index to partition ID mapping.

Returns:

List of Partition objects with subcircuits.

Return type:

list[Partition]