mqt.qecc.circuit_synthesis.circuit_utils¶
Utility methods for circuits.
Functions¶
|
Relabels the qubits in a stim circuit based on the given mapping. |
|
Convert a Qiskit circuit to a Stim circuit. |
|
Move circuit instructions to the front and ignore TICKS. |
|
Collect all layers that can be executed in parallel. |
|
Return a list of qubits that are not measured in circ. |
|
Return a list of qubits that are measured in circ. |
|
Compose two Stim circuits. |
Module Contents¶
- relabel_qubits(circ: stim.Circuit, qubit_mapping: dict[int, int] | int) stim.Circuit[source]¶
Relabels the qubits in a stim circuit based on the given mapping.
- qiskit_to_stim_circuit(qc: QuantumCircuit) stim.Circuit[source]¶
Convert a Qiskit circuit to a Stim circuit.
- compact_stim_circuit(circ: stim.Circuit) stim.Circuit[source]¶
Move circuit instructions to the front and ignore TICKS.
- Parameters:
circ – stim circuit to compact
- Returns:
A compacted stim circuit.
- collect_circuit_layers(circ: stim.Circuit) list[stim.Circuit][source]¶
Collect all layers that can be executed in parallel.
- Parameters:
circ – Stim circuit to process.
- Returns:
list of circuit layers. All instructions in one layer can be executed in parallel. It holds that circ=sum(collect_circuit_layers(circ)).
- unmeasured_qubits(circ: stim.Circuit) list[int][source]¶
Return a list of qubits that are not measured in circ.
- measured_qubits(circ: stim.Circuit) list[int][source]¶
Return a list of qubits that are measured in circ.
The qubits are in the ordered according to when they are measured.
- compose_circuits(circ1: stim.Circuit, circ2: stim.Circuit, wiring: dict[int, int] | None = None) tuple[stim.Circuit, dict[int, int], dict[int, int]][source]¶
Compose two Stim circuits.
The circuits are composed only along the qubits that are connected by the wiring dict. All other qubits are assumed to be unconnected. If wire is None, then the circuits are simply vertically stacked.
- Parameters:
circ1 – The first stim circuit.
circ2 – The second stim circuit.
wiring – Optional dict mapping outputs of circ1 to inputs of circ2.
- Returns:
mapping1: Maps qubits of circ1 to the composed circuit.
mapping2: Maps qubits of circ2 to the composed circuit.
- Return type:
A tuple containing the composed stim circuit and two mappings