mqt.ionshuttler.multi_shuttler.outside.compilation

Module Contents

extract_qubits_from_gate(gate_line: str) list[int][source]

Extract canonicalized qubit indices from a gate operation line.

is_qasm_file(file_path: Path) bool[source]

Return whether the file appears to contain an OpenQASM program.

parse_qasm(filename: Path) list[tuple[int, ...]][source]

Parse a QASM file and return qubits used for each gate preserving their order.

get_front_layer(dag: DAGDependency) list[DAGDepNode][source]

Get the front layer of the DAG.

remove_node(dag: DAGDependency, node: DAGDepNode) None[source]

Execute a node and update the DAG (remove the node and its edges).

manual_copy_dag(dag: DAGDependency) DAGDependency[source]
build_dag_gate_id_lookup(dag: DAGDependency, gate_info: dict[int, GateInfo]) dict[int, int][source]

Match DAG nodes to parsed gate ids by qubits and operation name.

create_dag(filename: Path) DAGDependency[source]
create_initial_circuit(filename: Path) ParsedCircuit[source]

Return a canonicalized parsed circuit with stable gate ids.

create_initial_sequence(filename: Path) list[tuple[int, ...]][source]
create_updated_sequence_destructive(graph: Graph, filename: Path, dag_dep: DAGDependency | None, use_dag: bool) tuple[list[int], list[int], DAGDependency | None][source]
map_front_gates_to_pzs(graph: Graph, front_layer_nodes: list[DAGDepNode]) dict[str, list[DAGDepNode]][source]

Create list of all front layer gates at each processing zone.

remove_processed_gates(graph: Graph, dag: DAGDependency, removed_nodes: dict[str, DAGDepNode]) None[source]

Remove the processed gates of each processing zone from both the DAG and sequence.

Parameters:
  • graph – Graph object containing the gate sequence

  • dag – DAG representing dependencies between gates

  • first_gates_by_pz – Dictionary mapping processing zones to their first gates

get_all_first_gates_and_update_sequence_non_destructive(graph: Graph, dag: DAGDependency, max_rounds: int = 5) dict[str, DAGDepNode][source]

Get the first gates from the DAG for each processing zone (only first round, so they are simultaneously processable). Continue finding the subsequent “first gates” and update the sequence accordingly. Creates a compiled list of gates (ordered) for each pz from the DAG Dependency.