tqec.circuit.schedule.manipulation.merge_scheduled_circuits#
- merge_scheduled_circuits(circuits: list[ScheduledCircuit], global_qubit_map: QubitMap, mergeable_instructions: Iterable[str] = ()) ScheduledCircuit [source]#
Merge several ScheduledCircuit instances into one instance.
This function takes several compatible scheduled circuits as input and merge them, respecting their schedules, into a unique ScheduledCircuit instance that will then be returned to the caller.
The provided circuits should be compatible between each other. Compatible circuits are circuits that can all be described with a unique global qubit map. In other words, if two circuits from the list of compatible circuits use the same qubit index, that should mean that they use the same qubit. You can obtain compatible circuits by using
relabel_circuits_qubit_indices()
.- Parameters:
circuits – compatible circuits to merge.
qubit_map – global qubit map for all the provided circuits.
mergeable_instructions – a list of instruction names that are considered mergeable. Duplicate instructions with a name in this list will be merged into a single instruction.
- Returns:
a circuit representing the merged scheduled circuits given as input.