iqm.benchmarks.entanglement.ghz_optimal.cz_layers

Contents

iqm.benchmarks.entanglement.ghz_optimal.cz_layers#

iqm.benchmarks.entanglement.ghz_optimal.cz_layers(pairs: Sequence[tuple[int, int]]) → list[int]#

Assign each CX of the tree to the earliest layer it can run in.

The GHZ tree is built breadth first, but a breadth-first level is not a layer of the executed circuit: two CXs of the same level that share their control qubit have to be serialized, while CXs of different levels can overlap. Scheduling each gate as early as its two qubits allow (ASAP) reproduces what the barriers and the transpiler actually do, so gates sharing a layer index are the ones played in parallel.

Parameters:

pairs (Sequence[tuple[int, int]]) – (control, target) qubit indices in circuit order.

Returns:

The 0-based layer index of every pair.

Return type:

list[int]