qubit_padding

qubit_padding#

Full path: iqm.qrisp_iqm.passes.routing.core.qubit_padding

Helpers for padding a circuit out to the device qubit count.

Layout passes map the circuit onto a device topology that usually holds more qubits than the circuit uses. The missing qubits are appended as padding qubits named f"padding_qb_{counter}".

Because several passes can run one after another (e.g. manual_layout followed by plasma_layout), a pass must not restart the counter at zero: the incoming circuit may already carry padding qubits from an earlier pass, and reusing a name raises a ValueError. pad_qubits() therefore continues the numbering where the incoming circuit left off.

Module Attributes

PADDING_QUBIT_PREFIX

Name prefix of the qubits the layout passes append as padding.

Functions

next_padding_qubit_index(qc)

First padding-qubit counter value that is free in qc.

pad_qubits(qc, n_qubits)

Pad a quantum circuit in-place until it holds the given number of qubits.